Divider

Dividers bring clarity to a layout by grouping and dividing content in close proximity. They can also be used to establish rhythm and hierarchy.

installyarn add @react-spectrum/divider
version3.0.0-rc.1
usageimport {Divider} from '@react-spectrum/divider'

Example#


Horizontal#

Horizontal Dividers can be used as is because of how CSS Layout works. They may also be used in Flex and Grid containers.

<Divider marginTop="10px" marginBottom="10px" />
Content above
Content below

Vertical#

It is recommended to only use vertical Dividers in Flex or Grid containers. CSS Layout otherwise makes displaying a vertical Divider very difficult.

<Flex>
  Content left
  <Divider orientation="vertical" marginLeft="10px" marginRight="10px" />
  Content right
</Flex>
Content leftContent right

Props#


NameTypeDefaultDescription
size'S''M''L''L'How thick the Divider should be.
orientation'horizontal'The axis the Divider should align with.
UNSAFE_classNamestring
UNSAFE_styleCSSProperties
Layout
NameTypeDefaultDescription
flexstringnumberboolean
flexGrownumber
flexShrinknumber
flexBasisnumberstring
alignSelf'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'stretch'
justifySelf'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'
flexOrdernumber
gridAreastring
gridColumnstring
gridRowstring
gridColumnStartstring
gridColumnEndstring
gridRowStartstring
gridRowEndstring
slotstring
Spacing
NameTypeDefaultDescription
margin
marginTop
marginLeft
marginRight
marginBottom
marginStart
marginEnd
marginX
marginY
Sizing
NameTypeDefaultDescription
width
minWidth
maxWidth
height
minHeight
maxHeight
Positioning
NameTypeDefaultDescription
position'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'
top
bottom
left
right
start
end
zIndexnumber
isHiddenboolean
Accessibility
NameTypeDefaultDescription
rolestring
idstring
tabIndexnumber
aria-labelstringDefines a string value that labels the current element.
aria-labelledbystringIdentifies the element (or elements) that labels the current element.
aria-describedbystringIdentifies the element (or elements) that describes the object.
aria-controlsstringIdentifies the element (or elements) whose contents or presence are controlled by the current element.
aria-ownsstring

Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.

aria-hiddenboolean'false''true'Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.