@hubspot/cms-component-library 0.3.0 → 0.3.2

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 (33) hide show
  1. package/components/componentLibrary/Button/index.tsx +1 -1
  2. package/components/componentLibrary/Divider/StyleFields.tsx +72 -14
  3. package/components/componentLibrary/Divider/index.tsx +31 -16
  4. package/components/componentLibrary/Divider/llm.txt +97 -103
  5. package/components/componentLibrary/Divider/stories/Divider.stories.tsx +30 -19
  6. package/components/componentLibrary/Divider/types.ts +31 -20
  7. package/components/componentLibrary/Flex/index.module.scss +4 -6
  8. package/components/componentLibrary/Flex/llm.txt +5 -7
  9. package/components/componentLibrary/Flex/types.ts +0 -4
  10. package/components/componentLibrary/Icon/StyleFields.tsx +69 -0
  11. package/components/componentLibrary/Icon/index.module.scss +2 -2
  12. package/components/componentLibrary/Icon/index.tsx +6 -2
  13. package/components/componentLibrary/Icon/llm.txt +7 -6
  14. package/components/componentLibrary/Icon/stories/Icon.stories.tsx +11 -11
  15. package/components/componentLibrary/Icon/stories/IconDecorator.module.scss +1 -2
  16. package/components/componentLibrary/Icon/types.ts +26 -1
  17. package/components/componentLibrary/Text/ContentFields.tsx +66 -0
  18. package/components/componentLibrary/Text/index.module.scss +3 -0
  19. package/components/componentLibrary/Text/index.tsx +27 -0
  20. package/components/componentLibrary/Text/llm.txt +170 -0
  21. package/components/componentLibrary/Text/types.ts +16 -0
  22. package/components/componentLibrary/_patterns/css-patterns.md +7 -18
  23. package/package.json +4 -4
  24. package/components/componentLibrary/Divider/ContentFields.tsx +0 -63
  25. package/components/componentLibrary/Heading/ContentFields.tsx +0 -37
  26. package/components/componentLibrary/Heading/StyleFields.tsx +0 -40
  27. package/components/componentLibrary/Heading/index.module.scss +0 -11
  28. package/components/componentLibrary/Heading/index.tsx +0 -52
  29. package/components/componentLibrary/Heading/llm.txt +0 -175
  30. package/components/componentLibrary/Heading/stories/Heading.stories.tsx +0 -88
  31. package/components/componentLibrary/Heading/stories/HeadingDecorator.module.scss +0 -47
  32. package/components/componentLibrary/Heading/stories/HeadingDecorator.tsx +0 -8
  33. package/components/componentLibrary/Heading/types.ts +0 -35
@@ -39,7 +39,7 @@ const ButtonComponent = ({
39
39
  const icon = (
40
40
  <Icon
41
41
  fieldPath={iconFieldPath}
42
- height={iconSize}
42
+ size={iconSize}
43
43
  className={styles.icon}
44
44
  showIcon={showIcon}
45
45
  purpose={iconPurpose}
@@ -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
@@ -13,7 +13,7 @@ const meta: Meta<DividerProps> = {
13
13
  layout: 'centered',
14
14
  docs: {
15
15
  description: {
16
- component: `The Divider component provides a visual separator between content sections. It supports both horizontal and vertical orientations with customizable styling options including border style, thickness, length, and spacing.`,
16
+ component: `The Divider component provides a visual separator between content sections. It supports both horizontal and vertical orientations with customizable styling options including line type, thickness, length, alignment, color, and spacing.`,
17
17
  },
18
18
  },
19
19
  },
@@ -26,7 +26,6 @@ type Story = StoryObj<typeof meta>;
26
26
  export const Default: Story = {
27
27
  args: {
28
28
  orientation: 'horizontal',
29
- alignment: 'stretch',
30
29
  borderStyle: 'solid',
31
30
  length: 100,
32
31
  thickness: 1,
@@ -196,25 +195,37 @@ export const Alignment: Story = {
196
195
  <SBContainer addBackground flex>
197
196
  <h4>Stretch (Default)</h4>
198
197
  <p>Divider stretches to fill available space</p>
199
- <Divider length={100} thickness={1} alignment="stretch" />
198
+ <Divider length={100} thickness={1} />
200
199
  </SBContainer>
201
200
 
202
201
  <SBContainer addBackground flex>
203
- <h4>Start</h4>
204
- <p>Divider aligns to the start (left for horizontal)</p>
205
- <Divider length={50} thickness={1} alignment="start" />
202
+ <h4>Left</h4>
203
+ <p>Divider aligns to the left</p>
204
+ <Divider
205
+ length={50}
206
+ thickness={1}
207
+ alignment={{ horizontal_align: 'LEFT' }}
208
+ />
206
209
  </SBContainer>
207
210
 
208
211
  <SBContainer addBackground flex>
209
212
  <h4>Center</h4>
210
213
  <p>Divider aligns to the center</p>
211
- <Divider length={50} thickness={1} alignment="center" />
214
+ <Divider
215
+ length={50}
216
+ thickness={1}
217
+ alignment={{ horizontal_align: 'CENTER' }}
218
+ />
212
219
  </SBContainer>
213
220
 
214
221
  <SBContainer addBackground flex>
215
- <h4>End</h4>
216
- <p>Divider aligns to the end (right for horizontal)</p>
217
- <Divider length={50} thickness={1} alignment="end" />
222
+ <h4>Right</h4>
223
+ <p>Divider aligns to the right</p>
224
+ <Divider
225
+ length={50}
226
+ thickness={1}
227
+ alignment={{ horizontal_align: 'RIGHT' }}
228
+ />
218
229
  </SBContainer>
219
230
  </SBContainer>
220
231
  ),
@@ -323,8 +334,8 @@ export const VerticalAlignment: Story = {
323
334
  render: () => (
324
335
  <SBContainer flex direction="column" gap="large">
325
336
  <SBContainer addBackground>
326
- <h4>Start</h4>
327
- <p>Divider aligns to the start (top for vertical)</p>
337
+ <h4>Top</h4>
338
+ <p>Divider aligns to the top</p>
328
339
  <div
329
340
  style={{
330
341
  display: 'flex',
@@ -337,7 +348,7 @@ export const VerticalAlignment: Story = {
337
348
  orientation="vertical"
338
349
  length={50}
339
350
  thickness={1}
340
- alignment="start"
351
+ alignment={{ vertical_align: 'TOP' }}
341
352
  spacing="16px"
342
353
  />
343
354
  <span>Right</span>
@@ -345,8 +356,8 @@ export const VerticalAlignment: Story = {
345
356
  </SBContainer>
346
357
 
347
358
  <SBContainer addBackground>
348
- <h4>Center</h4>
349
- <p>Divider aligns to the center</p>
359
+ <h4>Middle</h4>
360
+ <p>Divider aligns to the middle</p>
350
361
  <div
351
362
  style={{
352
363
  display: 'flex',
@@ -359,7 +370,7 @@ export const VerticalAlignment: Story = {
359
370
  orientation="vertical"
360
371
  length={50}
361
372
  thickness={1}
362
- alignment="center"
373
+ alignment={{ vertical_align: 'MIDDLE' }}
363
374
  spacing="16px"
364
375
  />
365
376
  <span>Right</span>
@@ -367,8 +378,8 @@ export const VerticalAlignment: Story = {
367
378
  </SBContainer>
368
379
 
369
380
  <SBContainer addBackground>
370
- <h4>End</h4>
371
- <p>Divider aligns to the end (bottom for vertical)</p>
381
+ <h4>Bottom</h4>
382
+ <p>Divider aligns to the bottom</p>
372
383
  <div
373
384
  style={{
374
385
  display: 'flex',
@@ -381,7 +392,7 @@ export const VerticalAlignment: Story = {
381
392
  orientation="vertical"
382
393
  length={50}
383
394
  thickness={1}
384
- alignment="end"
395
+ alignment={{ vertical_align: 'BOTTOM' }}
385
396
  spacing="16px"
386
397
  />
387
398
  <span>Right</span>