feat: Vertical divider variant - #4081
Conversation
📝 WalkthroughWalkthroughThe Divider component now supports horizontal and vertical orientations, including orientation-specific styling, spacing, documentation, and ARIA output. A vertical stats example demonstrates separators between adjacent items. ChangesDivider orientation support
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Divider
participant dividerStencil
participant RenderedHR
Divider->>dividerStencil: pass space and orientation
dividerStencil->>RenderedHR: apply orientation-specific styles
Divider->>RenderedHR: set aria-orientation
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Workday/canvas-kit
|
||||||||||||||||||||||||||||||||||||||||
| Project |
Workday/canvas-kit
|
| Branch Review |
ISSUE-4063
|
| Run status |
|
| Run duration | 02m 24s |
| Commit |
|
| Committer | Jaclyn |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
17
|
|
|
0
|
|
|
809
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
19.51%
|
|
|---|---|
|
|
1537
|
|
|
370
|
Accessibility
99.47%
|
|
|---|---|
|
|
5 critical
5 serious
0 moderate
2 minor
|
|
|
72
|
There was a problem hiding this comment.
Pull request overview
Adds a new vertical orientation variant to the Preview Divider component so it can be used as either a horizontal rule (default) or a vertical separator in row-based layouts.
Changes:
- Introduces
orientation?: 'horizontal' | 'vertical'onDividerand updates the stencil to render horizontal vs. vertical styles. - Sets
aria-orientationbased on theorientationprop for improved accessibility semantics. - Adds a new
Verticalexample showcasing usage of vertical dividers between inline stats.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
modules/preview-react/divider/stories/examples/Vertical.tsx |
Adds a new example for vertical dividers in a horizontal row layout. |
modules/preview-react/divider/lib/Divider.tsx |
Adds orientation support in the stencil + component, and wires ARIA orientation. |
Comments suppressed due to low confidence (1)
modules/preview-react/divider/stories/examples/Vertical.tsx:34
- The array returned by
stats.map(...)uses an unkeyed fragment (<>...</>), which will trigger React’s “missing key” warning. Use a keyedFragment(or another keyed wrapper) for each iteration.
{stats.map((stat, index) => (
<>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const Vertical = () => { | ||
| const lastIndex = stats.length - 1; | ||
| return ( |
| import {Divider} from '@workday/canvas-kit-preview-react/divider'; | ||
| import {createStyles} from '@workday/canvas-kit-styling'; | ||
| import {system} from '@workday/canvas-tokens-web'; |
| Component: ({space, orientation = 'horizontal', ...elemProps}: DividerProps, ref, Element) => ( | ||
| <Element | ||
| ref={ref} | ||
| aria-orientation={orientation} | ||
| {...handleCsProp(elemProps, dividerStencil({space, orientation}))} | ||
| /> | ||
| ), |
| /** | ||
| * Sets the orientation of the `Divider`. | ||
| * * `horizontal` - renders a horizontal rule to segment stacked content. | ||
| * * `vertical` - renders a vertical rule to segment content laid out in a row. The `Divider` stretches to fill | ||
| * the height of its container, so it should be placed inside an element with a defined height (e.g. a flex or | ||
| * grid container). | ||
| * @default 'horizontal' | ||
| */ | ||
| orientation?: 'horizontal' | 'vertical'; |
Summary
Resolves: #4063
New Vertical Variant for Divider
Release Category
Components
Release Note
New Vertical Variant for Divider
Checklist
ready for reviewhas been added to PRFor the Reviewer
Where Should the Reviewer Start?
Areas for Feedback? (optional)
Testing Manually
Thank You Gif (optional)
Summary by CodeRabbit
New Features
Documentation