@hubspot/cms-component-library 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/components/componentLibrary/Accordion/AccordionItem/index.module.scss +4 -0
  2. package/components/componentLibrary/Accordion/AccordionTitle/ContentFields.tsx +1 -0
  3. package/components/componentLibrary/Accordion/AccordionTitle/icons.tsx +19 -0
  4. package/components/componentLibrary/Accordion/AccordionTitle/index.module.scss +4 -0
  5. package/components/componentLibrary/Accordion/AccordionTitle/index.tsx +3 -1
  6. package/components/componentLibrary/Accordion/AccordionTitle/types.ts +1 -1
  7. package/components/componentLibrary/Accordion/llm.txt +7 -6
  8. package/components/componentLibrary/Accordion/stories/Accordion.stories.tsx +21 -0
  9. package/components/componentLibrary/Divider/StyleFields.tsx +72 -14
  10. package/components/componentLibrary/Divider/index.tsx +31 -16
  11. package/components/componentLibrary/Divider/llm.txt +97 -103
  12. package/components/componentLibrary/Divider/stories/Divider.stories.tsx +30 -19
  13. package/components/componentLibrary/Divider/types.ts +31 -20
  14. package/components/componentLibrary/Icon/StyleFields.tsx +69 -0
  15. package/components/componentLibrary/Icon/index.module.scss +11 -0
  16. package/components/componentLibrary/Icon/index.tsx +31 -4
  17. package/components/componentLibrary/Icon/llm.txt +50 -10
  18. package/components/componentLibrary/Icon/types.ts +29 -0
  19. package/components/componentLibrary/Text/ContentFields.tsx +66 -0
  20. package/components/componentLibrary/Text/index.module.scss +3 -0
  21. package/components/componentLibrary/Text/index.tsx +27 -0
  22. package/components/componentLibrary/Text/llm.txt +170 -0
  23. package/components/componentLibrary/Text/types.ts +16 -0
  24. package/package.json +4 -4
  25. package/components/componentLibrary/Divider/ContentFields.tsx +0 -63
@@ -18,3 +18,7 @@
18
18
  .accordionItem[open] :global(.accordionIconMinus) {
19
19
  display: block;
20
20
  }
21
+
22
+ .accordionItem[open] :global(.accordionIconCaret) {
23
+ transform: rotate(180deg);
24
+ }
@@ -18,6 +18,7 @@ const ContentFields = ({
18
18
  choices={[
19
19
  ['chevron', 'Chevron'],
20
20
  ['plus', 'Plus'],
21
+ ['caret', 'Caret'],
21
22
  ]}
22
23
  preset="expand_icon"
23
24
  required={false}
@@ -57,3 +57,22 @@ export const MinusIcon = () => {
57
57
  </svg>
58
58
  );
59
59
  };
60
+
61
+ export const CaretIcon = () => {
62
+ return (
63
+ <svg
64
+ className={cx(
65
+ styles.accordionIcon,
66
+ styles.accordionIconCaret,
67
+ 'accordionIconCaret'
68
+ )}
69
+ viewBox="0 0 24 24"
70
+ fill="currentColor"
71
+ xmlns="http://www.w3.org/2000/svg"
72
+ aria-hidden="true"
73
+ role="img"
74
+ >
75
+ <path d="M11.2445 16.5296C11.717 16.9121 12.4107 16.8859 12.8495 16.4471L17.6495 11.6471C17.9945 11.3021 18.0957 10.7884 17.9082 10.3384C17.7207 9.88836 17.2857 9.59961 16.802 9.59961H7.20195C6.7182 9.59961 6.27945 9.89211 6.09195 10.3421C5.90445 10.7921 6.00945 11.3059 6.35445 11.6471L11.1545 16.4471L11.2445 16.5296Z" />
76
+ </svg>
77
+ );
78
+ };
@@ -44,3 +44,7 @@
44
44
  height: 24px;
45
45
  }
46
46
 
47
+ .accordionIconCaret {
48
+ width: 24px;
49
+ height: 24px;
50
+ }
@@ -2,7 +2,7 @@ import styles from './index.module.scss';
2
2
  import ContentFields from './ContentFields.js';
3
3
  import cx from '../../utils/classname.js';
4
4
  import { AccordionTitleProps } from './types.js';
5
- import { ChevronIcon, PlusIcon, MinusIcon } from './icons.js';
5
+ import { ChevronIcon, PlusIcon, MinusIcon, CaretIcon } from './icons.js';
6
6
 
7
7
  const AccordionTitleComponent = ({
8
8
  icon = 'chevron',
@@ -24,6 +24,8 @@ const AccordionTitleComponent = ({
24
24
  );
25
25
  }
26
26
 
27
+ if (icon === 'caret') return <CaretIcon />;
28
+
27
29
  return null;
28
30
  };
29
31
 
@@ -1,4 +1,4 @@
1
- export type AccordionIconType = 'chevron' | 'plus';
1
+ export type AccordionIconType = 'chevron' | 'plus' | 'caret';
2
2
 
3
3
  export type AccordionTitleProps = {
4
4
  icon?: AccordionIconType;
@@ -104,10 +104,10 @@ Accordion/
104
104
  **Props:**
105
105
  ```tsx
106
106
  {
107
- icon?: 'chevron' | 'plus'; // Icon type (default: 'chevron')
108
- className?: string; // Additional CSS classes
109
- style?: React.CSSProperties; // Inline styles
110
- children?: React.ReactNode; // Title text content
107
+ icon?: 'chevron' | 'plus' | 'caret'; // Icon type (default: 'chevron')
108
+ className?: string; // Additional CSS classes
109
+ style?: React.CSSProperties; // Inline styles
110
+ children?: React.ReactNode; // Title text content
111
111
  }
112
112
  ```
113
113
 
@@ -243,7 +243,7 @@ Configurable props for title text and icon:
243
243
 
244
244
  **Fields:**
245
245
  - `title`: TextField for accordion title text
246
- - `icon`: ChoiceField for selecting icon type (chevron, plus)
246
+ - `icon`: ChoiceField for selecting icon type (caret, chevron, plus)
247
247
 
248
248
  #### AccordionContent.ContentFields
249
249
 
@@ -397,6 +397,7 @@ The Accordion component uses CSS variables for theming and customization. Variab
397
397
  - `.accordionIconChevron`: Chevron-specific sizing (rotates 180° when open)
398
398
  - `.accordionIconPlus`: Plus icon (hidden when open)
399
399
  - `.accordionIconMinus`: Minus icon (shown when open)
400
+ - `.accordionIconCaret`: Caret icon (rotates 180° when open)
400
401
 
401
402
  **AccordionContent (`AccordionContent/index.module.scss`):**
402
403
  - `.accordionContent`: Content area with padding and typography
@@ -420,7 +421,7 @@ The Accordion component follows accessibility best practices:
420
421
 
421
422
  ## Best Practices
422
423
 
423
- - **Choose appropriate icons**: Use `chevron` for subtle indication, `plus` for clearer expand/collapse semantics (common in FAQs)
424
+ - **Choose appropriate icons**: Use `caret` for a compact filled triangle indicator, `chevron` for subtle indication, `plus` for clearer expand/collapse semantics (common in FAQs)
424
425
  - **Consistent variants**: Apply the same variant to all items within an accordion for visual consistency
425
426
  - **Gap selection**: Use any valid CSS length value (e.g., '8px', '16px', '24px', '48px') for spacing between items
426
427
  - **Dynamic rendering**: Always provide unique `key` props when mapping arrays to AccordionItems
@@ -106,6 +106,27 @@ export const IconOptions: Story = {
106
106
  </AccordionItem>
107
107
  </Accordion>
108
108
  </SBContainer>
109
+
110
+ <SBContainer addBackground>
111
+ <h4>Caret Icon</h4>
112
+ <Accordion gap="16px">
113
+ <AccordionItem>
114
+ <AccordionTitle icon="caret">Caret Icon</AccordionTitle>
115
+ <AccordionContent>
116
+ <p>
117
+ The caret icon provides a simple visual cue for the expanded
118
+ state.
119
+ </p>
120
+ </AccordionContent>
121
+ </AccordionItem>
122
+ <AccordionItem>
123
+ <AccordionTitle icon="caret">Another caret item</AccordionTitle>
124
+ <AccordionContent>
125
+ <p>This is just some caret cake.</p>
126
+ </AccordionContent>
127
+ </AccordionItem>
128
+ </Accordion>
129
+ </SBContainer>
109
130
  </SBContainer>
110
131
  ),
111
132
  };
@@ -1,25 +1,83 @@
1
- import { ChoiceField } from '@hubspot/cms-components/fields';
1
+ import {
2
+ AlignmentField,
3
+ ChoiceField,
4
+ ColorField,
5
+ NumberField,
6
+ } from '@hubspot/cms-components/fields';
2
7
  import { StyleFieldsProps } from './types.js';
3
8
 
4
9
  const StyleFields = ({
5
- borderStyleLabel = 'Border style',
10
+ hideFields = [],
11
+ borderStyleLabel = 'Line type',
6
12
  borderStyleName = 'borderStyle',
7
13
  borderStyleDefault = 'solid',
14
+ thicknessLabel = 'Line thickness',
15
+ thicknessName = 'thickness',
16
+ thicknessDefault = 1,
17
+ lengthLabel = 'Line length',
18
+ lengthName = 'length',
19
+ lengthDefault = 100,
20
+ alignmentLabel = 'Line alignment',
21
+ alignmentName = 'alignment',
22
+ alignmentDefault = { horizontal_align: 'CENTER', vertical_align: 'MIDDLE' },
23
+ alignmentDirection = 'HORIZONTAL',
24
+ colorLabel = 'Line color',
25
+ colorName = 'color',
26
+ colorDefault = { color: '#000000', opacity: 100 },
8
27
  }: StyleFieldsProps) => {
9
28
  return (
10
29
  <>
11
- <ChoiceField
12
- label={borderStyleLabel}
13
- name={borderStyleName}
14
- required={true}
15
- choices={[
16
- ['solid', 'Solid'],
17
- ['dotted', 'Dotted'],
18
- ['dashed', 'Dashed'],
19
- ['double', 'Double'],
20
- ]}
21
- default={borderStyleDefault}
22
- />
30
+ {!hideFields.includes('borderStyle') && (
31
+ <ChoiceField
32
+ label={borderStyleLabel}
33
+ name={borderStyleName}
34
+ required={true}
35
+ choices={[
36
+ ['solid', 'Solid'],
37
+ ['dotted', 'Dotted'],
38
+ ['dashed', 'Dashed'],
39
+ ['double', 'Double'],
40
+ ]}
41
+ default={borderStyleDefault}
42
+ />
43
+ )}
44
+ {!hideFields.includes('color') && (
45
+ <ColorField
46
+ label={colorLabel}
47
+ name={colorName}
48
+ default={colorDefault}
49
+ showOpacity={false}
50
+ />
51
+ )}
52
+ {!hideFields.includes('thickness') && (
53
+ <NumberField
54
+ label={thicknessLabel}
55
+ name={thicknessName}
56
+ required={true}
57
+ suffix="px"
58
+ min={1}
59
+ default={thicknessDefault}
60
+ />
61
+ )}
62
+ {!hideFields.includes('length') && (
63
+ <NumberField
64
+ label={lengthLabel}
65
+ name={lengthName}
66
+ required={true}
67
+ suffix="%"
68
+ min={1}
69
+ max={100}
70
+ default={lengthDefault}
71
+ />
72
+ )}
73
+ {!hideFields.includes('alignment') && (
74
+ <AlignmentField
75
+ label={alignmentLabel}
76
+ name={alignmentName}
77
+ alignmentDirection={alignmentDirection}
78
+ default={alignmentDefault}
79
+ />
80
+ )}
23
81
  </>
24
82
  );
25
83
  };
@@ -1,30 +1,46 @@
1
1
  import styles from './index.module.scss';
2
2
  import cx from '../utils/classname.js';
3
3
  import type { CSSVariables } from '../utils/types.js';
4
- import { DividerAlignment, DividerProps } from './types.js';
5
- import ContentFields from './ContentFields.js';
4
+ import { DividerOrientation, DividerProps } from './types.js';
6
5
  import StyleFields from './StyleFields.js';
7
6
 
8
- const getAlignmentCSSVar = (alignment: DividerAlignment) => {
9
- switch (alignment) {
10
- case 'start':
11
- return `flex-${alignment}`;
12
- case 'end':
13
- return `flex-${alignment}`;
14
- case 'center':
15
- return alignment;
16
- default:
17
- return 'stretch';
7
+ const getAlignmentCSSVar = (
8
+ alignment: DividerProps['alignment'],
9
+ orientation: DividerOrientation
10
+ ): string => {
11
+ if (!alignment) return 'stretch';
12
+
13
+ if (orientation === 'horizontal') {
14
+ switch (alignment.horizontal_align) {
15
+ case 'LEFT':
16
+ return 'flex-start';
17
+ case 'CENTER':
18
+ return 'center';
19
+ case 'RIGHT':
20
+ return 'flex-end';
21
+ }
22
+ } else {
23
+ switch (alignment.vertical_align) {
24
+ case 'TOP':
25
+ return 'flex-start';
26
+ case 'MIDDLE':
27
+ return 'center';
28
+ case 'BOTTOM':
29
+ return 'flex-end';
30
+ }
18
31
  }
32
+
33
+ return 'stretch';
19
34
  };
20
35
 
21
36
  const DividerComponent = ({
22
37
  orientation = 'horizontal',
23
- alignment = 'stretch',
38
+ alignment,
24
39
  spacing,
25
40
  borderStyle = 'solid',
26
41
  length = 100,
27
42
  thickness = 1,
43
+ color,
28
44
  variant = 'primary', // !todo: not used atm but keeping for when we need to add variant system.
29
45
  className = '',
30
46
  style = {},
@@ -37,8 +53,9 @@ const DividerComponent = ({
37
53
  const combinedClasses = cx(defaultClasses, className);
38
54
 
39
55
  const cssVariables: CSSVariables = {
40
- '--hscl-divider-alignment': getAlignmentCSSVar(alignment),
56
+ '--hscl-divider-alignment': getAlignmentCSSVar(alignment, orientation),
41
57
  '--hscl-divider-borderStyle': borderStyle,
58
+ '--hscl-divider-borderColor': color?.rgba ?? color?.color,
42
59
  [`--hscl-divider-margin${
43
60
  orientation === 'horizontal' ? 'Block' : 'Inline'
44
61
  }`]: spacing,
@@ -63,12 +80,10 @@ const DividerComponent = ({
63
80
 
64
81
  // Create compound component with proper typing
65
82
  type DividerComponentType = typeof DividerComponent & {
66
- ContentFields: typeof ContentFields;
67
83
  StyleFields: typeof StyleFields;
68
84
  };
69
85
 
70
86
  const Divider = DividerComponent as DividerComponentType;
71
- Divider.ContentFields = ContentFields;
72
87
  Divider.StyleFields = StyleFields;
73
88
 
74
89
  export default Divider;
@@ -9,7 +9,7 @@ import Divider from '@hubspot/cms-component-library/Divider';
9
9
 
10
10
  ## Purpose
11
11
 
12
- The Divider component provides a consistent way to create visual separators in HubSpot CMS projects. It renders semantic HTML elements (`<hr>` for horizontal, `<div role="separator">` for vertical) with flexible styling options. Developers should use this component when they need to visually separate content sections, whether between stacked content (horizontal) or side-by-side content (vertical). The component supports customizable border styles, thickness, length, alignment, and spacing through props and CSS variables.
12
+ The Divider component provides a consistent way to create visual separators in HubSpot CMS projects. It renders semantic HTML elements (`<hr>` for horizontal, `<div role="separator">` for vertical) with flexible styling options. Developers should use this component when they need to visually separate content sections, whether between stacked content (horizontal) or side-by-side content (vertical). The component supports customizable line type, thickness, length, alignment, color, and spacing through props and CSS variables.
13
13
 
14
14
  ## Component Structure
15
15
 
@@ -17,7 +17,6 @@ The Divider component provides a consistent way to create visual separators in H
17
17
  Divider/
18
18
  ├── index.tsx # Main component with render logic
19
19
  ├── types.ts # TypeScript type definitions
20
- ├── ContentFields.tsx # HubSpot field definitions for content
21
20
  ├── StyleFields.tsx # HubSpot field definitions for styling
22
21
  ├── index.module.scss # CSS module with design tokens
23
22
  └── stories/
@@ -35,15 +34,19 @@ Divider/
35
34
  **Props:**
36
35
  ```tsx
37
36
  {
38
- orientation?: 'horizontal' | 'vertical'; // Divider orientation (default: 'horizontal')
39
- alignment?: 'stretch' | 'start' | 'center' | 'end'; // Alignment within parent container (default: 'stretch')
40
- spacing?: string; // Margin spacing in pixel format (e.g., '16px', '24px')
41
- borderStyle?: 'solid' | 'dotted' | 'dashed' | 'double'; // Border line style (default: 'solid')
42
- length?: number; // Length as percentage (1-100) of available space (default: 100)
43
- thickness?: number; // Border thickness in pixels (default: 1)
44
- variant?: 'primary' | 'secondary' | 'tertiary'; // Visual style variant (default: 'primary')
45
- className?: string; // Additional CSS classes
46
- style?: React.CSSProperties; // Inline styles (including CSS variables)
37
+ orientation?: 'horizontal' | 'vertical'; // Divider orientation (default: 'horizontal')
38
+ alignment?: { // Alignment within parent container
39
+ horizontal_align?: 'LEFT' | 'CENTER' | 'RIGHT';
40
+ vertical_align?: 'TOP' | 'MIDDLE' | 'BOTTOM';
41
+ };
42
+ spacing?: string; // Margin spacing in pixel format (e.g., '16px', '24px')
43
+ borderStyle?: 'solid' | 'dotted' | 'dashed' | 'double'; // Border line style (default: 'solid')
44
+ length?: number; // Length as percentage (1-100) of available space (default: 100)
45
+ thickness?: number; // Border thickness in pixels (default: 1)
46
+ color?: { rgba?: string; color?: string; opacity?: number }; // Line color (from ColorField or rgba value)
47
+ variant?: 'primary' | 'secondary' | 'tertiary'; // Visual style variant (default: 'primary')
48
+ className?: string; // Additional CSS classes
49
+ style?: React.CSSProperties; // Inline styles (including CSS variables)
47
50
  }
48
51
  ```
49
52
 
@@ -52,10 +55,18 @@ Divider/
52
55
  - `orientation="vertical"`: Renders as `<div role="separator">` with left border
53
56
 
54
57
  **Alignment Behavior:**
55
- - `stretch` (default): Divider uses full available space
56
- - `start`: Aligns to the start of the container (left for horizontal, top for vertical)
57
- - `center`: Centers within the container
58
- - `end`: Aligns to the end of the container (right for horizontal, bottom for vertical)
58
+
59
+ When no `alignment` is passed, the divider stretches to fill the available space (default).
60
+
61
+ For horizontal dividers, use `horizontal_align`:
62
+ - `'LEFT'`: Aligns to the left (`flex-start`)
63
+ - `'CENTER'`: Centers within the container
64
+ - `'RIGHT'`: Aligns to the right (`flex-end`)
65
+
66
+ For vertical dividers, use `vertical_align`:
67
+ - `'TOP'`: Aligns to the top (`flex-start`)
68
+ - `'MIDDLE'`: Centers vertically
69
+ - `'BOTTOM'`: Aligns to the bottom (`flex-end`)
59
70
 
60
71
  ## Usage Examples
61
72
 
@@ -64,7 +75,7 @@ Divider/
64
75
  ```tsx
65
76
  import Divider from '@hubspot/cms-component-library/Divider';
66
77
 
67
- // Default horizontal divider
78
+ // Default horizontal divider (full width, stretch)
68
79
  <Divider />
69
80
  ```
70
81
 
@@ -78,66 +89,41 @@ import Divider from '@hubspot/cms-component-library/Divider';
78
89
  ### Horizontal Divider with Custom Spacing
79
90
 
80
91
  ```tsx
81
- // Divider with more spacing above and below
82
- <Divider
83
- orientation="horizontal"
84
- spacing="32px"
85
- />
92
+ <Divider spacing="32px" />
86
93
  ```
87
94
 
88
- ### Vertical Divider with Custom Height
95
+ ### Short Centered Divider
89
96
 
90
97
  ```tsx
91
- // Vertical divider at 80% height
92
- <Divider
93
- orientation="vertical"
94
- length={80}
95
- alignment="center"
96
- />
98
+ <Divider length={50} alignment={{ horizontal_align: 'CENTER' }} spacing="16px" />
97
99
  ```
98
100
 
99
- ### Customized Divider with Dashed Style
101
+ ### Customized Divider
100
102
 
101
103
  ```tsx
102
104
  <Divider
103
- orientation="horizontal"
104
105
  borderStyle="dashed"
105
106
  thickness={2}
106
107
  length={75}
107
- alignment="center"
108
+ alignment={{ horizontal_align: 'CENTER' }}
108
109
  spacing="24px"
109
110
  />
110
111
  ```
111
112
 
112
- ### Thick Divider for Emphasis
113
-
114
- ```tsx
115
- <Divider
116
- orientation="horizontal"
117
- thickness={4}
118
- borderStyle="solid"
119
- />
120
- ```
121
-
122
- ### Dotted Divider
113
+ ### Colored Divider
123
114
 
124
115
  ```tsx
125
- <Divider
126
- orientation="horizontal"
127
- borderStyle="dotted"
128
- thickness={2}
129
- />
116
+ // color.rgba is populated by the ColorField in a module context
117
+ <Divider color={{ rgba: 'rgba(59, 130, 246, 1)' }} thickness={2} />
130
118
  ```
131
119
 
132
- ### Short Centered Divider
120
+ ### Vertical Divider with Alignment
133
121
 
134
122
  ```tsx
135
- // Decorative short divider, centered
136
123
  <Divider
137
- orientation="horizontal"
124
+ orientation="vertical"
138
125
  length={50}
139
- alignment="center"
140
- spacing="16px"
126
+ alignment={{ vertical_align: 'MIDDLE' }}
141
127
  />
142
128
  ```
143
129
 
@@ -158,51 +144,53 @@ import Divider from '@hubspot/cms-component-library/Divider';
158
144
 
159
145
  ### Field Definitions
160
146
 
161
- The Divider component provides field definitions for easy integration with HubSpot CMS modules.
147
+ All Divider fields are style fields. The Divider component exposes only `StyleFields` there are no content fields.
162
148
 
163
- #### ContentFields
149
+ #### StyleFields
164
150
 
165
- Configurable props for divider appearance:
151
+ All configurable style props for the divider:
166
152
 
167
153
  ```tsx
168
- <Divider.ContentFields
169
- orientationLabel="Divider Orientation"
170
- orientationName="orientation"
171
- orientationDefault="horizontal"
172
- alignmentLabel="Divider Alignment"
173
- alignmentName="alignment"
174
- alignmentDefault="stretch"
175
- lengthLabel="Divider Length"
176
- lengthName="length"
177
- lengthDefault={100}
178
- thicknessLabel="Divider Thickness"
154
+ <Divider.StyleFields
155
+ borderStyleLabel="Line type"
156
+ borderStyleName="borderStyle"
157
+ borderStyleDefault="solid"
158
+ thicknessLabel="Line thickness"
179
159
  thicknessName="thickness"
180
160
  thicknessDefault={1}
161
+ lengthLabel="Line length"
162
+ lengthName="length"
163
+ lengthDefault={100}
164
+ alignmentLabel="Line alignment"
165
+ alignmentName="alignment"
166
+ alignmentDefault={{ horizontal_align: 'CENTER', vertical_align: 'MIDDLE' }}
167
+ alignmentDirection="HORIZONTAL"
168
+ colorLabel="Line color"
169
+ colorName="color"
170
+ colorDefault={{ color: '#000000', opacity: 100 }}
181
171
  />
182
172
  ```
183
173
 
184
174
  **Fields:**
185
- - `orientation`: ChoiceField for selecting horizontal or vertical orientation
186
- - `alignment`: ChoiceField for alignment (stretch, start, center, end)
187
- - `length`: NumberField for length percentage (1-100)
188
- - `thickness`: NumberField for thickness in pixels (minimum: 1)
175
+ - `borderStyle`: ChoiceField for line type (solid, dotted, dashed, double)
176
+ - `thickness`: NumberField for thickness in pixels (minimum: 1, suffix: px)
177
+ - `length`: NumberField for length as a percentage (1100, suffix: %)
178
+ - `alignment`: AlignmentField for alignment within the container
179
+ - `color`: ColorField for line color (opacity hidden — color only)
189
180
 
190
- #### StyleFields
181
+ **Developer-only props (not user-facing):**
182
+ - `alignmentDirection`: Controls whether the AlignmentField shows horizontal or vertical options. Accepts `'HORIZONTAL'` (default) or `'VERTICAL'`. Set this based on how the divider will be used — developers consuming the component set this, not end users.
183
+ - `hideFields`: An array of field names to opt out of rendering. All fields are shown by default (opt-out). Accepts an array of `StyleFieldName` values: `'borderStyle' | 'color' | 'thickness' | 'length' | 'alignment'`.
191
184
 
192
- Configurable props for divider border style:
185
+ **Hiding fields example:**
193
186
 
194
187
  ```tsx
195
- <Divider.StyleFields
196
- borderStyleLabel="Border Style"
197
- borderStyleName="borderStyle"
198
- borderStyleDefault="solid"
199
- />
188
+ <FieldGroup label="Style" name="style" tab="STYLE">
189
+ <Divider.StyleFields hideFields={['alignment', 'length']} />
190
+ </FieldGroup>
200
191
  ```
201
192
 
202
- **Fields:**
203
- - `borderStyle`: ChoiceField for selecting border style (solid, dotted, dashed, double)
204
-
205
- **Note:** The `spacing` prop must be set directly on the Divider component, as there is no field definition for it in StyleFields or ContentFields.
193
+ **Note:** The `orientation` and `spacing` props must be set directly on the Divider component — there are no field definitions for them.
206
194
 
207
195
  ### Module Usage Example
208
196
 
@@ -210,13 +198,15 @@ Configurable props for divider border style:
210
198
  import Divider from '@hubspot/cms-component-library/Divider';
211
199
 
212
200
  export default function SectionDividerModule({ fieldValues }) {
201
+ const { borderStyle, thickness, length, alignment, color } = fieldValues.style;
202
+
213
203
  return (
214
204
  <Divider
215
- orientation={fieldValues.orientation}
216
- alignment={fieldValues.alignment}
217
- borderStyle={fieldValues.borderStyle}
218
- length={fieldValues.length}
219
- thickness={fieldValues.thickness}
205
+ borderStyle={borderStyle}
206
+ thickness={thickness}
207
+ length={length}
208
+ alignment={alignment}
209
+ color={color}
220
210
  spacing="24px"
221
211
  />
222
212
  );
@@ -231,7 +221,6 @@ import Divider from '@hubspot/cms-component-library/Divider';
231
221
 
232
222
  export const fields = (
233
223
  <ModuleFields>
234
- <Divider.ContentFields />
235
224
  <FieldGroup label="Style" name="style" tab="STYLE">
236
225
  <Divider.StyleFields />
237
226
  </FieldGroup>
@@ -239,24 +228,28 @@ export const fields = (
239
228
  );
240
229
  ```
241
230
 
231
+ For a vertical divider module, pass `alignmentDirection` to expose vertical alignment options:
232
+
233
+ ```tsx
234
+ <FieldGroup label="Style" name="style" tab="STYLE">
235
+ <Divider.StyleFields alignmentDirection="VERTICAL" />
236
+ </FieldGroup>
237
+ ```
238
+
242
239
  ## Styling
243
240
 
244
241
  ### CSS Variables
245
242
 
246
243
  The Divider component uses CSS variables for theming and customization:
247
244
 
248
- **Base Styles:**
249
245
  - `--hscl-divider-borderColor`: Border color (default: currentColor)
250
246
  - `--hscl-divider-borderStyle`: Border style (default: solid)
251
- - `--hscl-divider-length`: Length as percentage (default: 100%)
252
- - `--hscl-divider-thickness`: Border thickness as pixel value (default: 1px)
247
+ - `--hscl-divider-borderWidth`: Border thickness as pixel value (default: 1px)
253
248
  - `--hscl-divider-alignment`: Flex alignment value (default: stretch)
254
-
255
- **Spacing:**
256
- - `--hscl-divider-spacing`: Spacing around the divider
257
- - Horizontal: Applied as `margin-block` (top and bottom)
258
- - Vertical: Applied as `margin-inline` (left and right)
259
-
249
+ - `--hscl-divider-width`: Width for horizontal dividers (default: 100%)
250
+ - `--hscl-divider-height`: Height for vertical dividers (default: 100%)
251
+ - `--hscl-divider-marginBlock`: Top/bottom margin for horizontal dividers (default: 16px)
252
+ - `--hscl-divider-marginInline`: Left/right margin for vertical dividers (default: 16px)
260
253
 
261
254
  ## Accessibility
262
255
 
@@ -266,7 +259,6 @@ The Divider component follows accessibility best practices:
266
259
  - Horizontal: Uses native `<hr>` element, recognized by screen readers as thematic break
267
260
  - Vertical: Uses `<div role="separator">` for proper ARIA semantics
268
261
  - **Keyboard Navigation**: Does not interfere with keyboard navigation as it's non-interactive
269
- - **Visual Separation**: Provides clear visual boundaries between content sections
270
262
  - **Screen Reader Support**: Properly announced by assistive technologies as content separators
271
263
 
272
264
  ## Best Practices
@@ -275,16 +267,18 @@ The Divider component follows accessibility best practices:
275
267
  - Use `horizontal` for separating stacked content sections (most common)
276
268
  - Use `vertical` for separating side-by-side content within a Flex or Grid layout
277
269
  - **Alignment considerations**:
278
- - Use `stretch` (default) for full-width/height separators
279
- - Use `center` for decorative short dividers
280
- - Use `start` or `end` for aligned content sections
270
+ - Omit `alignment` for full-width/height stretch behavior (default)
271
+ - Use `{ horizontal_align: 'CENTER' }` for decorative short horizontal dividers
272
+ - Use `{ vertical_align: 'MIDDLE' }` for centered vertical dividers
273
+ - Set `alignmentDirection` on `StyleFields` to match the intended orientation so users see the right alignment options
281
274
  - **Spacing guidelines**:
282
275
  - Use `spacing` prop to control margin around the divider
283
276
  - For horizontal dividers, spacing controls top/bottom margin
284
277
  - For vertical dividers, spacing controls left/right margin
285
- - **Length as percentage**: The `length` prop accepts 1-100 as a percentage, not pixel values
286
- - **Thickness control**: Use the `thickness` prop for border thickness (in pixels)
287
- - **Border styles**: Choose appropriate border style for visual hierarchy:
278
+ - **Length as percentage**: The `length` prop accepts 1100 as a percentage, not pixel values
279
+ - **Thickness control**: Use the `thickness` prop for border thickness (in pixels). Double border style requires at least 3px
280
+ - **Color**: The `color` prop is populated from the `ColorField` in a module context. In non-module usage, pass `{ rgba: 'rgba(...)' }` directly
281
+ - **Line type**: Choose appropriate border style for visual hierarchy:
288
282
  - `solid`: Default, clear separation
289
283
  - `dashed`: Less prominent, informal
290
284
  - `dotted`: Subtle, minimal separation