Divider
Dividers provide essential visual structure by creating boundaries between content areas, helping users navigate and process information more effectively.
import {Divider} from "@qualcomm-ui/react/divider"Examples
Showcase
<div className="text-neutral-primary font-body-md">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</div>
<Divider />
<div className="text-neutral-primary font-body-md">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</div>
Variants
Use variant to change the visual emphasis level of the divider.
<span className="text-neutral-primary font-body-md">
subtle: Low contrast, less visually prominent
</span>
<Divider variant="subtle" />
<span className="text-neutral-primary font-body-md">
normal (default): Standard appearance with balanced visibility
</span>
<Divider />
<span className="text-neutral-primary font-body-md">
strong: High contrast, maximum visual separation
</span>
<Divider variant="strong" />
Orientation
By default, a divider has a horizontal orientation. You can change this by setting the orientation prop to vertical.
<span className="text-neutral-primary font-body-md">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</span>
<Divider orientation="vertical" />
<span className="text-neutral-primary font-body-md">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</span>
Focusable
By default, a divider is not focusable. You can change this by setting a tabindex value. Authors can assign aria-label to provide accessible names to dividers.
A focusable divider must expose a value to accessibility tools. Authors must set the "aria-valuenow" attribute.
<span className="text-neutral-primary font-body-md">
By default a divider has no tabindex value assigned and is not
focusable.
</span>
<Divider />
<span className="text-neutral-primary font-body-md">
The following divider has a tabindex of 0, which makes it focusable.
</span>
<Divider aria-label="Second section" tabIndex={0} />
<span className="text-neutral-primary font-body-md">
The following divider has a tabindex of -1, which makes it
programmatically focusable.
</span>
<Divider aria-label="Third section" tabIndex={-1} />
<span className="text-neutral-primary font-body-md">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</span>
Value Text
When the value itself is not sufficient to describe the state of the component, authors can provide a more descriptive text using the valueText prop.
<span className="text-neutral-primary font-body-md">Section 1</span>
<Divider
aria-valuenow={25}
aria-valuetext="The value is 25"
tabIndex={0}
/>
<span className="text-neutral-primary font-body-md">Section 2</span>
<Divider
aria-valuenow={50}
aria-valuetext="The value is 50"
tabIndex={0}
/>
<span className="text-neutral-primary font-body-md">Section 3</span>
<Divider
aria-valuenow={75}
aria-valuetext="The value is 75"
tabIndex={0}
/>
<span className="text-neutral-primary font-body-md">Section 4</span>
API
<Divider>
| Prop | Type | Default |
|---|---|---|
Controls whether the divider renders horizontally or vertically. | | 'horizontal' | 'horizontal' |
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement | |
Visual emphasis level of the divider. | | 'subtle' | 'normal' |
| 'horizontal'
| 'vertical'
| ReactElement
| ((
props: object,
) => ReactElement)
| 'subtle'
| 'normal'
| 'strong'
| Attribute / Property | Value |
|---|---|
className | string |
data-variant | | 'subtle' |
classNamestringdata-variant| 'subtle'
| 'normal'
| 'strong'
<div>element by default.