Bento

Use the bento to present content in a responsive grid layout.
import {Bento} from '@primer/react-brand'

Default

Example layout

Examples

Dark mode items

Responsive behavior

Use columnSpan, rowSpan, columnStart, rowStart, flow, verticalAlign, horizontalAlign with an Object of breakpoint-specific keys and values corresponding to each type to enable responsive behavior for each of these properties.

Breakpoints use min-width, where it will also apply your chosen span value to all larger breakpoints.

Bento items can render in a different source order to what is presented visually. It's important to ensure that the content of each item is self-contained and can be read independently of its adjacent items.

Responsive flow

Component props

Bento

NameTypeDefaultRequiredDescription
classNamestringfalseSets a custom class on the root element

The Bento component API supports all standard HTML attribute props for the interface HTMLDivElement.

Bento.Item

NameTypeDefaultRequiredDescription
classNamestringfalseSets a custom class on the root element
childrenReact.ReactNode, React.ReactNode[]falseThe children to be rendered within the Bento.Item
columnStart1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ResponsiveColumnIndexfalseThe column number in which this content should start
columnSpan1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ResponsiveColumnIndexfalseThe number of columns this content should span
rowStartnumber, ResponsiveRowIndexfalseThe row number in which this content should start
rowSpannumber, ResponsiveRowIndexfalseThe number of rows this content should span
flow"row", "column", ResponsiveFlowfalseThe flow of the Bento.Content and Bento.Visual within the Bento.Item
colorMode"light", "dark""light"falseThe color mode specified for this Bento.Item
visualAsBackgroundbooleanfalsefalseDetermines if the Bento.Visual child element is set as the background for the Bento.Item with the Bento.Content overlayed
order"default", "reversed", ResponsiveOrderdefaultfalseDetermines the visual order for the Bento.Item. This changes the semantic ordering of elements for accessibility.

The Bento.Item component API supports all standard HTML attribute props for the interface HTMLDivElement, while providing some additional behavior as described above.

Bento.Content

NameTypeDefaultRequiredDescription
classNamestringfalseSets a custom class on the root element
childrenText,Bento.Heading, LinkfalseThe children to be rendered within the Bento.Content
leadingVisualReactElement, IconfalseSets the icon before the heading text
padding"condensed", "normal", "spacious", ResponsivePadding"normal"falseSets a custom class on the root element
horizontalAlign"start", "center", "end", ResponsiveAlign"start"falseThe horizontal alignment of children within the Bento.Content
verticalAlign"start", "center", "end", ResponsiveAlign"start"falseThe vertical alignment of children within the Bento.Content.

The Bento.Content component API supports all standard HTML attribute props for the interface HTMLDivElement, while providing some additional behavior as described above.

Bento.Heading

Required node that is used to provide a heading for the Bento.Content.

nametypedefaultrequireddescription
classNamestringfalseCustom class name for the heading component
childrenReactNode, ReactNode[]undefinedtrueContent to be displayed inside the heading component.

Forwards all props from the Heading component, including as, size, and weight.

Bento.Visual

NameTypeDefaultRequiredDescription
classNamestringfalseSets a custom class on the root element
fillMediabooleantruefalseDetermines how the visual reacts within its container. Either filling the container or contained within.
positionstring"50% 50%"falseThe positioning of the visual.
padding"condensed", "normal", "spacious", ResponsivePaddingfalseSets a custom class on the root element

The Bento.Visual component API supports all standard HTML attribute props for the interface HTMLDivElement, while providing some additional behavior as described above.