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.2
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.

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

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>

Props#


NameTypeDefaultDescription
size'S''M''L''L'How thick the Divider should be.
orientationOrientation'horizontal'The axis the Divider should align with.
UNSAFE_classNamestringThe className to apply to the element. Do not use unless completely necessary as it may break component styling.
UNSAFE_styleCSSPropertiesThe inline styles to apply to the element. Do not use unless completely necessary as it may break component styling.
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"divider"A slot to place the divider in.
Spacing
NameTypeDefaultDescription
marginDimensionValue
marginTopDimensionValue
marginLeftDimensionValue
marginRightDimensionValue
marginBottomDimensionValue
marginStartDimensionValue
marginEndDimensionValue
marginXDimensionValue
marginYDimensionValue
Sizing
NameTypeDefaultDescription
widthDimensionValue
minWidthDimensionValue
maxWidthDimensionValue
heightDimensionValue
minHeightDimensionValue
maxHeightDimensionValue
Positioning
NameTypeDefaultDescription
position'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'
topDimensionValue
bottomDimensionValue
leftDimensionValue
rightDimensionValue
startDimensionValue
endDimensionValue
zIndexnumber
isHiddenboolean
Accessibility
NameTypeDefaultDescription
idstringThe element's unique identifier.
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-detailsstringIdentifies the element (or elements) that provide a detailed, extended description for the object.