LayoutReact
A separator element accessible to screen readers: a line between groups of content that is also announced as a break.
Rendered by React 19.3.1
32Tests passing in React · 0 failing
2.3 KiBSize
Not measured yetMemory
Not measured yetSpeed
productdevbook and 10 upstream authors6 commits · last
Installation
npm i @hamur/reactNot on npm yet. The package goes out under the chosen name.
Anatomy
Import the component and assemble its parts:
<Separator />Examples
The demo at the top is the one example this component has so far.
API reference
1 props across 1 parts, in React syntax. className, style, render are listed once, under Shared props.
SeparatorSeparator
A separator element accessible to screen readers. Renders a <div>.
| Prop | Type | Default |
|---|---|---|
orientationThe orientation of the separator. | Orientation | 'horizontal' |
| Data attribute | Description |
|---|---|
data-orientation | Indicates the orientation of the separator. |
Shared props
Every part that renders an element takes these.
| Prop | Type |
|---|---|
classNameCSS class applied to the element, or a function that
returns a class based on the component's state. | string | ((state: State) => string | undefined) |
styleStyle applied to the element, or a function that
returns a style object based on the component's state. | React.CSSProperties | ((state: State) => React.CSSProperties | undefined) |
renderAllows you to replace the component's HTML element
with a different tag, or compose it with another component. | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, State> |
Keyboard and accessibility
Keyboard
Separator takes no focus and has no keys.
Accessibility
| Part | Sets | So that |
|---|---|---|
| Separator | role="separator" | a screen reader announces the break between groups |
| Separator | aria-orientation from orientation | the break is read as horizontal or vertical |
Focus order
- Separator is not focusable; focus passes over it.