Content

Content is used to specify primary content of a component.

installyarn add @react-spectrum/view
version3.0.0-alpha.1
usageimport {Content} from '@react-spectrum/view'

Examples#


<Content>Try another search</Content>

Content#


The Content component is used as a child to other components. Based on the component it is used within, it gets Spectrum styling and may have a preassigned slot for positioning. By virtue of its name, the Content component provides semantic meaning in the context they are placed. An example of this is explained in Dialog and it is also used by IllustratedMessage. It is important to note that the Content element accepts any renderable node, not just strings.

A Content is used to specify the content of a component. Example usage can be found in Dialog and IllustratedMessage.

Props#


NameTypeDefaultDescription
childrenReactNodeContent content
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
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
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-ownsstringIdentifies 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.