Intro
Box er en av våre layout primitives. Det er en layout-komponent som ofte brukes som byggestein for andre komponenter. Den setter padding, border, background etc. med design tokens.
Eksempler
Propen 'background' lar deg sette bakgrunnsfarge basert på tokens.
Propen 'padding' lar deg sette padding responsivt basert på brekkpunkt. Verdien mapper til tokens, så f.eks. '4' tilsvarer '--a-spacing-4' som er '1rem'.
Propen 'paddingInline' gir deg mer kontroll over horisontal padding.
Propen 'paddingBlock' gir deg mer kontroll over vertikal padding.
Propen 'borderWidth' gir deg kontroll over border.
Propen 'borderColor' lar deg endre border-color basert på tokens.
Propen 'borderRadius' lar deg sette border-radius basert på tokens. Du kan også enkelt endre border-radius basert på brekkpunkt.
Propen 'shadow' lar deg sette box-shadow basert på tokens.
Box lar deg enklere bygge opp kjente grensesnitt gjennom felles tokens og brekkpunkt.
Box erstatter den avviklede komponenten Panel.
Tilgjengelighet
Box er ikke en erstatning for semantisk HTML. Bruk as
-prop aktivt. Støtter OverridableComponent.
Props
Box
as?
- Type:
React.ElementType
- Description:
background?
- Type:
"bg-default" | "bg-subtle" | "surface-default" | "surface-selected" | "surface-subtle" | "surface-transparent" | "surface-backdrop" | "surface-inverted" | "surface-action-subtle" | ... 28 more ...
- Description:
borderColor?
- Type:
"border-default" | "border-strong" | "border-divider" | "border-subtle" | "border-action-selected" | "border-action-hover" | "border-action" | "border-selected" | "border-success" | ... 10 more ...
- Description:
borderRadius?
- Type:
ResponsiveProp<SpaceDelimitedAttribute<BorderRadiiToken>>
- Description:
- Example:
borderWidth?
- Type:
SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">
- Description:
- Example:
shadow?
- Type:
"small" | "medium" | "large" | "xlarge" | "xsmall"
- Description:
- Example:
padding?
- Type:
ResponsiveProp<"0" | "1" | "2" | "3" | "4" | "5" | "05" | "1-alt" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "18" | "20" | "24" | "32">
- Description:
- Example:
paddingInline?
- Type:
ResponsiveProp<"0" | "0 0" | "1" | "2" | "3" | "4" | "5" | "0 1" | "0 2" | "0 3" | "0 4" | "0 5" | "1 0" | "1 1" | "1 2" | "1 3" | "1 4" | "1 5" | "2 0" | "2 1" | "2 2" | "2 3" | "2 4" | "2 5" | "3 0" | ... 436 more ... | "32 32">
- Description:
- Example:
paddingBlock?
- Type:
ResponsiveProp<"0" | "0 0" | "1" | "2" | "3" | "4" | "5" | "0 1" | "0 2" | "0 3" | "0 4" | "0 5" | "1 0" | "1 1" | "1 2" | "1 3" | "1 4" | "1 5" | "2 0" | "2 1" | "2 2" | "2 3" | "2 4" | "2 5" | "3 0" | ... 436 more ... | "32 32">
- Description:
- Example:
margin?
- Type:
ResponsiveProp<"0" | "1" | "2" | "3" | "4" | "5" | "05" | "1-alt" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "18" | "20" | "24" | "32">
- Description:
- Example:
marginInline?
- Type:
ResponsiveProp<"0" | "0 0" | "1" | "2" | "3" | "4" | "5" | "0 1" | "0 2" | "0 3" | "0 4" | "0 5" | "1 0" | "1 1" | "1 2" | "1 3" | "1 4" | "1 5" | "2 0" | "2 1" | "2 2" | "2 3" | "2 4" | "2 5" | "3 0" | ... 479 more ... | "32 auto">
- Description:
- Example:
marginBlock?
- Type:
ResponsiveProp<"0" | "0 0" | "1" | "2" | "3" | "4" | "5" | "0 1" | "0 2" | "0 3" | "0 4" | "0 5" | "1 0" | "1 1" | "1 2" | "1 3" | "1 4" | "1 5" | "2 0" | "2 1" | "2 2" | "2 3" | "2 4" | "2 5" | "3 0" | ... 479 more ... | "32 auto">
- Description:
- Example:
width?
- Type:
ResponsiveProp<string>
- Description:
minWidth?
- Type:
ResponsiveProp<string>
- Description:
maxWidth?
- Type:
ResponsiveProp<string>
- Description:
height?
- Type:
ResponsiveProp<string>
- Description:
minHeight?
- Type:
ResponsiveProp<string>
- Description:
maxHeight?
- Type:
ResponsiveProp<string>
- Description:
position?
- Type:
ResponsiveProp<"static" | "relative" | "absolute" | "fixed" | "sticky">
- Description:
inset?
- Type:
ResponsiveProp<"0" | "0 0" | "1" | "2" | "3" | "4" | "5" | "0 1" | "0 2" | "0 3" | "0 4" | "0 5" | "1 0" | "1 1" | "1 2" | "1 3" | "1 4" | "1 5" | "2 0" | "2 1" | "2 2" | "2 3" | "2 4" | "2 5" | "3 0" | ... 436 more ... | "32 32">
- Description:
- Example:
top?
- Type:
ResponsiveProp<"0" | "1" | "2" | "3" | "4" | "5" | "05" | "1-alt" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "18" | "20" | "24" | "32">
- Description:
- Example:
right?
- Type:
ResponsiveProp<"0" | "1" | "2" | "3" | "4" | "5" | "05" | "1-alt" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "18" | "20" | "24" | "32">
- Description:
- Example:
bottom?
- Type:
ResponsiveProp<"0" | "1" | "2" | "3" | "4" | "5" | "05" | "1-alt" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "18" | "20" | "24" | "32">
- Description:
- Example:
left?
- Type:
ResponsiveProp<"0" | "1" | "2" | "3" | "4" | "5" | "05" | "1-alt" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "18" | "20" | "24" | "32">
- Description:
- Example:
overflow?
- Type:
ResponsiveProp<"auto" | "visible" | "hidden" | "clip" | "scroll">
- Description:
overflowX?
- Type:
ResponsiveProp<"auto" | "visible" | "hidden" | "clip" | "scroll">
- Description:
overflowY?
- Type:
ResponsiveProp<"auto" | "visible" | "hidden" | "clip" | "scroll">
- Description:
flexBasis?
- Type:
ResponsiveProp<string>
- Description:
flexShrink?
- Type:
ResponsiveProp<string>
- Description:
flexGrow?
- Type:
ResponsiveProp<string>
- Description:
gridColumn?
- Type:
ResponsiveProp<string>
- Description:
asChild?
- Type:
boolean
- Description:
- Example:
ref?
- Type:
LegacyRef<HTMLDivElement>
- Description:
Tokens
Tokens brukt internt i Box bør ikke overskrives.