View

A View is a generic layout component.

Under the hood, it's basically a <div> element with some sensible defaults:

box-sizing: border-box
display: flex;
flex-direction: column;
flex-wrap: nowrap;
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
align-items: stretch;

It supports responsive object or array values for all it's style props. Array values map according to the number of values passed:

Number of valuesResponsive style
1default
2default, fromM
3default, fromM, fromL
4default, fromM, fromL, fromXL

All padding and margin values are based on multiples of the baselineGrid which is 8px.

Example

Props - View

NameDescriptionTypeDefault Value
alignContentSets align-content.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | AlignContent | undefined>n/a
alignItemsSets align-items.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | AlignItems | undefined>n/a
alignSelfSets align-self.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | AlignSelf | undefined>n/a
asAs<any>n/a
backgroundColorA custom background colorResponsiveProp<(('${string}var(--${string})${string}' | '${string}calc(${string})${string}' | BackgroundColor) & ("background.primary" | "background.secondary" | Omit<string, "">)) | undefined>n/a
basisSets flex-basis.ResponsiveProp<FlexBasis<string | number> | undefined>n/a
bgResponsiveProp<Background<string | number> | undefined>n/a
directionSets the flex-direction.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | FlexDirection | undefined>n/a
displaySets display.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | Display | undefined>n/a
extendA CSS object or a function returning a CSS object, or an array of themExtendPropValue<CurrentTheme, { backgroundColor?: ResponsiveProp<(('${string}var(--${string})${string}' | '${string}calc(${string})${string}' | BackgroundColor) & ("background.primary" | "background.secondary" | Omit<...>)) | undefined>; ... 29 more ...; height?: ResponsiveProp<...>; }>n/a
flexSets flex.ResponsiveProp<Flex<string | number> | undefined>n/a
growSets flex-grow.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | FlexGrow | undefined>n/a
heightSets height.ResponsiveProp<Height<string | number> | undefined>n/a
justifyContentSets justify-content.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | JustifyContent | undefined>n/a
marginAdds margin based on the baselineGrid. Overwritten by specific directional margins.ResponsiveProp<Margin<string | number> | undefined>n/a
marginBottomAdds bottom margin based on the baselineGrid.ResponsiveProp<MarginBottom<string | number> | undefined>n/a
marginLeftAdds left margin based on the baselineGrid.ResponsiveProp<MarginLeft<string | number> | undefined>n/a
marginRightAdds right margin based on the baselineGrid.ResponsiveProp<MarginRight<string | number> | undefined>n/a
marginTopAdds top margin based on the baselineGrid.ResponsiveProp<MarginTop<string | number> | undefined>n/a
maxHeightSets max-height.ResponsiveProp<MaxHeight<string | number> | undefined>n/a
maxWidthSets max-width.ResponsiveProp<MaxWidth<string | number> | undefined>n/a
minHeightSets min-height.ResponsiveProp<MinHeight<string | number> | undefined>n/a
minWidthSets min-width.ResponsiveProp<MinWidth<string | number> | undefined>n/a
orderSets order.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | Order | undefined>n/a
paddingAdds padding based on the baselineGrid. Overwritten by specific directional paddings.ResponsiveProp<Padding<string | number> | undefined>n/a
paddingBottomAdds bottom padding based on the baselineGrid.ResponsiveProp<PaddingBottom<string | number> | undefined>n/a
paddingLeftAdds left padding based on the baselineGrid.ResponsiveProp<PaddingLeft<string | number> | undefined>n/a
paddingRightAdds right padding based on the baselineGrid.ResponsiveProp<PaddingRight<string | number> | undefined>n/a
paddingTopAdds top padding based on the baselineGrid.ResponsiveProp<PaddingTop<string | number> | undefined>n/a
refanyn/a
shrinkSets flex-shrink.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | FlexShrink | undefined>n/a
spacingAdds spacing between children based on the baselineGrid.ResponsiveProp<string | number> | undefinedn/a
widthSets width.ResponsiveProp<Width<string | number> | undefined>n/a
wrapSets flex-wrap.ResponsiveProp<'${string}var(--${string})${string}' | '${string}calc(${string})${string}' | FlexWrap | undefined>n/a
2024 © Volvo Car Corporation