OctantisWeb.Components.PolarisWC.SGrid (octantis v0.2.0)
View SourceUse s-grid to organize your content in a matrix of rows and columns and make responsive layouts for pages. Grid follows the same pattern as the CSS grid layout.
Useful for
- Organizing content into a grid-like layout with columns and rows with consistent alignment and spacing.
- Creating responsive layouts with consistent spacing.
Considerations
- Grid doesn't include any padding by default. If you need padding around your grid, use
baseto apply the default padding. - Grid will allow children to overflow unless template rows/columns are properly set.
- Grid will always wrap children to a new line. If you need to control the wrapping behavior, use
s-stackors-box.
Example
<.s_grid
grid_template_columns="repeat(2, 1fr)"
gap="small"
justify_content="center"
>
<:s_grid_item grid_column="span 2" border="base" border_style="dashed">
Summary of sales
</:s_grid_item>
<:s-grid-item grid_column="span 1" border="base" border_style="dashed">
Orders
</:s_grid_item>
<:s_grid_item grid_column="auto" border="base" border_style="dashed">
Customers
</:s_grid_item>
</.s_grid>See:
Summary
Functions
Use s-grid to organize your content in a matrix of rows and columns and make responsive layouts for pages. Grid follows the same pattern as the CSS grid layout.
Functions
Use s-grid to organize your content in a matrix of rows and columns and make responsive layouts for pages. Grid follows the same pattern as the CSS grid layout.
Useful for
- Organizing content into a grid-like layout with columns and rows with consistent alignment and spacing.
- Creating responsive layouts with consistent spacing.
Considerations
- Grid doesn't include any padding by default. If you need padding around your grid, use
baseto apply the default padding. - Grid will allow children to overflow unless template rows/columns are properly set.
- Grid will always wrap children to a new line. If you need to control the wrapping behavior, use
s-stackors-box.
Example
<.s_grid
grid_template_columns="repeat(2, 1fr)"
gap="small"
justify_content="center"
>
<:s_grid_item grid_column="span 2" border="base" border_style="dashed">
Summary of sales
</:s_grid_item>
<:s-grid-item grid_column="span 1" border="base" border_style="dashed">
Orders
</:s_grid_item>
<:s_grid_item grid_column="auto" border="base" border_style="dashed">
Customers
</:s_grid_item>
</.s_grid>See:
Attributes
accessibility_label(:string) - stringA label that describes the purpose or contents of the element. When set, it will be announced to users using assistive technologies and will provide them with more context.
Only use this when the element's content is not enough context for users using assistive technologies.
accessibility_role(:string) - AccessibilityRoleSets the semantic meaning of the component’s content. When set, the role will be used by assistive technologies to help users navigate the page.
accessibility_visibility(:string) - "visible" | "hidden" | "exclusive"Changes the visibility of the element.
visible: the element is visible to all users.hidden: the element is removed from the accessibility tree but remains visible.exclusive: the element is visually hidden but remains in the accessibility tree.
align_content(:string) - "" | AlignContentKeywordAligns the grid along the block (column) axis.
This overrides the block value of
placeContent.align_items(:string) - "" | AlignItemsKeywordAligns the grid items along the block (column) axis.
This overrides the block value of
placeItems.background(:string) - BackgroundColorKeywordAdjust the background of the element.
block_size(:string) - "auto" | SizeUnitsAdjust the block size.
border(:string) - BorderShorthandSet the border via the shorthand property.
This can be a size, optionally followed by a color, optionally followed by a style.
If the color is not specified, it will be
base.If the style is not specified, it will be
auto.Values can be overridden by
borderWidth,borderStyle, andborderColor.border_color(:string) - "" | ColorKeywordSet the color of the border.
If set, it takes precedence over the
borderproperty's color.border_radius(:string) - MaybeAllValuesShorthandProperty<BoxBorderRadii>Set the radius of the border.
1-to-4-value syntax is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is:
- 4 values:
start-start start-end end-end end-start - 3 values:
start-start (start-end & end-start) start-end - 2 values:
(start-start & end-end) (start-end & end-start)
For example:
small-100means start-start, start-end, end-end and end-start border radii aresmall-100.small-100 nonemeans start-start and end-end border radii aresmall-100, start-end and end-start border radii arenone.small-100 none large-100means start-start border radius issmall-100, start-end border radius isnone, end-end border radius islarge-100and end-start border radius isnone.small-100 none large-100 small-100means start-start border radius issmall-100, start-end border radius isnone, end-end border radius islarge-100and end-start border radius issmall-100.
- 4 values:
border_style(:string) - "" | MaybeAllValuesShorthandProperty<BoxBorderStyles>Set the style of the border.
If set, it takes precedence over the
borderproperty's style.Like CSS, up to 4 values can be specified.
If one value is specified, it applies to all sides.
If two values are specified, they apply to the block sides and inline sides respectively.
If three values are specified, they apply to the block-start, both inline sides, and block-end respectively.
If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
border_width(:string) - "" | MaybeAllValuesShorthandProperty<"small" | "small-100" | "base" | "large" | "large-100" | "none">Set the width of the border.
If set, it takes precedence over the
borderproperty's width.Like CSS, up to 4 values can be specified.
If one value is specified, it applies to all sides.
If two values are specified, they apply to the block sides and inline sides respectively.
If three values are specified, they apply to the block-start, both inline sides, and block-end respectively.
If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
column_gap(:string) - MaybeResponsive<"" | SpacingKeyword>Adjust spacing between elements in the inline axis.
This overrides the column value of
gap.columnGapeither accepts:- a single SpacingKeyword value (e.g.
large-100) - OR a responsive value string with the supported SpacingKeyword as a query value.
- a single SpacingKeyword value (e.g.
display(:string) - MaybeResponsive<"auto" | "none">Sets the outer display type of the component. The outer type sets a component's participation in flow layout.
autothe component's initial value. The actual value depends on the component and context.nonehides the component from display and removes it from the accessibility tree, making it invisible to screen readers.
gap(:string) - MaybeResponsive<MaybeTwoValuesShorthandProperty<SpacingKeyword>>Adjust spacing between elements.
gapcan either accept:- a single SpacingKeyword value applied to both axes (e.g.
large-100) - OR a pair of values (eg
large-100 large-500) can be used to set the inline and block axes respectively - OR a responsive value string with the supported SpacingKeyword as a query value.
- a single SpacingKeyword value applied to both axes (e.g.
grid_template_columns(:any) - Define columns and specify their size. gridTemplateColumns either accepts:track sizing values (e.g. 1fr auto) OR responsive values string with the supported track sizing values as a query value.
grid_template_rows(:any) - Define rows and specify their size. gridTemplateRows either accepts:track sizing values (e.g. 1fr auto) OR responsive values string with the supported track sizing values as a query value.inline_size(:string) - "auto" | SizeUnitsAdjust the inline size.
justify_content(:string) - "" | JustifyContentKeywordAligns the grid along the inline (row) axis.
This overrides the inline value of
placeContent.justify_items(:string) - "" | JustifyItemsKeywordAligns the grid items along the inline (row) axis.
This overrides the inline value of
placeItems.max_block_size(:string) - "none" | SizeUnitsAdjust the maximum block size.
max_inline_size(:string) - "none" | SizeUnitsAdjust the maximum inline size.
min_block_size(:string) - SizeUnitsAdjust the minimum block size.
min_inline_size(:string) - SizeUnitsAdjust the minimum inline size.
overflow(:string) - "visible" | "hidden"Sets the overflow behavior of the element.
hidden: clips the content when it is larger than the element’s container. The element will not be scrollable and the users will not be able to access the clipped content by dragging or using a scroll wheel on a mouse.visible: the content that extends beyond the element’s container is visible.
padding(:string) - MaybeResponsive<MaybeAllValuesShorthandProperty<PaddingKeyword>>Adjust the padding of all edges.
1-to-4-value syntax is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is:
- 4 values:
block-start inline-end block-end inline-start - 3 values:
block-start inline block-end - 2 values:
block inline
For example:
largemeans block-start, inline-end, block-end and inline-start paddings arelarge.large nonemeans block-start and block-end paddings arelarge, inline-start and inline-end paddings arenone.large none largemeans block-start padding islarge, inline-end padding isnone, block-end padding islargeand inline-start padding isnone.large none large smallmeans block-start padding islarge, inline-end padding isnone, block-end padding islargeand inline-start padding issmall.
A padding value of
autowill use the default padding for the closest container that has had its usual padding removed.paddingalso accepts a responsive value string with the supported PaddingKeyword as a query value.- 4 values:
padding_block(:string) - MaybeResponsive<"" | MaybeTwoValuesShorthandProperty<PaddingKeyword>>Adjust the block-padding.
large nonemeans block-start padding islarge, block-end padding isnone.
This overrides the block value of
padding.paddingBlockalso accepts a responsive value string with the supported PaddingKeyword as a query value.padding_block_end(:string) - MaybeResponsive<"" | PaddingKeyword>Adjust the block-end padding.
This overrides the block-end value of
paddingBlock.paddingBlockEndalso accepts a responsive value string with the supported PaddingKeyword as a query value.padding_block_start(:string) - MaybeResponsive<"" | PaddingKeyword>Adjust the block-start padding.
This overrides the block-start value of
paddingBlock.paddingBlockStartalso accepts a responsive value string with the supported PaddingKeyword as a query value.padding_inline(:string) - MaybeResponsive<"" | MaybeTwoValuesShorthandProperty<PaddingKeyword>>Adjust the inline padding.
large nonemeans inline-start padding islarge, inline-end padding isnone.
This overrides the inline value of
padding.paddingInlinealso accepts a responsive value string with the supported PaddingKeyword as a query value.padding_inline_end(:string) - MaybeResponsive<"" | PaddingKeyword>Adjust the inline-end padding.
This overrides the inline-end value of
paddingInline.paddingInlineEndalso accepts a responsive value string with the supported PaddingKeyword as a query value.padding_inline_start(:string) - MaybeResponsive<"" | PaddingKeyword>Adjust the inline-start padding.
This overrides the inline-start value of
paddingInline.paddingInlineStartalso accepts a responsive value string with the supported PaddingKeyword as a query value.place_content(:string) - "normal normal" | "normal stretch" | "normal start" | "normal end" | "normal center" | "normal unsafe start" | "normal unsafe end" | "normal unsafe center" | "normal safe start" | "normal safe end" | "normal safe center" | "stretch normal" | "stretch stretch" | "stretch start" | "stretch end" | "stretch center" | "stretch unsafe start" | "stretch unsafe end" | "stretch unsafe center" | "stretch safe start" | "stretch safe end" | "stretch safe center" | "baseline normal" | "baseline stretch" | "baseline start" | "baseline end" | "baseline center" | "baseline unsafe start" | "baseline unsafe end" | "baseline unsafe center" | "baseline safe start" | "baseline safe end" | "baseline safe center" | "first baseline normal" | "first baseline stretch" | "first baseline start" | "first baseline end" | "first baseline center" | "first baseline unsafe start" | "first baseline unsafe end" | "first baseline unsafe center" | "first baseline safe start" | "first baseline safe end" | "first baseline safe center" | "last baseline normal" | "last baseline stretch" | "last baseline start" | "last baseline end" | "last baseline center" | "last baseline unsafe start" | "last baseline unsafe end" | "last baseline unsafe center" | "last baseline safe start" | "last baseline safe end" | "last baseline safe center" | "start normal" | "start stretch" | "start start" | "start end" | "start center" | "start unsafe start" | "start unsafe end" | "start unsafe center" | "start safe start" | "start safe end" | "start safe center" | "end normal" | "end stretch" | "end start" | "end end" | "end center" | "end unsafe start" | "end unsafe end" | "end unsafe center" | "end safe start" | "end safe end" | "end safe center" | "center normal" | "center stretch" | "center start" | "center end" | "center center" | "center unsafe start" | "center unsafe end" | "center unsafe center" | "center safe start" | "center safe end" | "center safe center" | "unsafe start normal" | "unsafe start stretch" | "unsafe start start" | "unsafe start end" | "unsafe start center" | "unsafe start unsafe start" | "unsafe start unsafe end" | "unsafe start unsafe center" | "unsafe start safe start" | "unsafe start safe end" | "unsafe start safe center" | "unsafe end normal" | "unsafe end stretch" | "unsafe end start" | "unsafe end end" | "unsafe end center" | "unsafe end unsafe start" | "unsafe end unsafe end" | "unsafe end unsafe center" | "unsafe end safe start" | "unsafe end safe end" | "unsafe end safe center" | "unsafe center normal" | "unsafe center stretch" | "unsafe center start" | "unsafe center end" | "unsafe center center" | "unsafe center unsafe start" | "unsafe center unsafe end" | "unsafe center unsafe center" | "unsafe center safe start" | "unsafe center safe end" | "unsafe center safe center" | "safe start normal" | "safe start stretch" | "safe start start" | "safe start end" | "safe start center" | "safe start unsafe start" | "safe start unsafe end" | "safe start unsafe center" | "safe start safe start" | "safe start safe end" | "safe start safe center" | "safe end normal" | "safe end stretch" | "safe end start" | "safe end end" | "safe end center" | "safe end unsafe start" | "safe end unsafe end" | "safe end unsafe center" | "safe end safe start" | "safe end safe end" | "safe end safe center" | "safe center normal" | "safe center stretch" | "safe center start" | "safe center end" | "safe center center" | "safe center unsafe start" | "safe center unsafe end" | "safe center unsafe center" | "safe center safe start" | "safe center safe end" | "safe center safe center" | AlignContentKeyword | "normal space-between" | "normal space-around" | "normal space-evenly" | "baseline space-between" | "baseline space-around" | "baseline space-evenly" | "first baseline space-between" | "first baseline space-around" | "first baseline space-evenly" | "last baseline space-between" | "last baseline space-around" | "last baseline space-evenly" | "start space-between" | "start space-around" | "start space-evenly" | "end space-between" | "end space-around" | "end space-evenly" | "center space-between" | "center space-around" | "center space-evenly" | "unsafe start space-between" | "unsafe start space-around" | "unsafe start space-evenly" | "unsafe end space-between" | "unsafe end space-around" | "unsafe end space-evenly" | "unsafe center space-between" | "unsafe center space-around" | "unsafe center space-evenly" | "safe start space-between" | "safe start space-around" | "safe start space-evenly" | "safe end space-between" | "safe end space-around" | "safe end space-evenly" | "safe center space-between" | "safe center space-around" | "safe center space-evenly" | "stretch space-between" | "stretch space-around" | "stretch space-evenly" | "space-between normal" | "space-between start" | "space-between end" | "space-between center" | "space-between unsafe start" | "space-between unsafe end" | "space-between unsafe center" | "space-between safe start" | "space-between safe end" | "space-between safe center" | "space-between stretch" | "space-between space-between" | "space-between space-around" | "space-between space-evenly" | "space-around normal" | "space-around start" | "space-around end" | "space-around center" | "space-around unsafe start" | "space-around unsafe end" | "space-around unsafe center" | "space-around safe start" | "space-around safe end" | "space-around safe center" | "space-around stretch" | "space-around space-between" | "space-around space-around" | "space-around space-evenly" | "space-evenly normal" | "space-evenly start" | "space-evenly end" | "space-evenly center" | "space-evenly unsafe start" | "space-evenly unsafe end" | "space-evenly unsafe center" | "space-evenly safe start" | "space-evenly safe end" | "space-evenly safe center" | "space-evenly stretch" | "space-evenly space-between" | "space-evenly space-around" | "space-evenly space-evenly"A shorthand property for
justify-contentandalign-content.place_items(:string) - AlignItemsKeyword | "normal normal" | "normal stretch" | "normal baseline" | "normal first baseline" | "normal last baseline" | "normal start" | "normal end" | "normal center" | "normal unsafe start" | "normal unsafe end" | "normal unsafe center" | "normal safe start" | "normal safe end" | "normal safe center" | "stretch normal" | "stretch stretch" | "stretch baseline" | "stretch first baseline" | "stretch last baseline" | "stretch start" | "stretch end" | "stretch center" | "stretch unsafe start" | "stretch unsafe end" | "stretch unsafe center" | "stretch safe start" | "stretch safe end" | "stretch safe center" | "baseline normal" | "baseline stretch" | "baseline baseline" | "baseline first baseline" | "baseline last baseline" | "baseline start" | "baseline end" | "baseline center" | "baseline unsafe start" | "baseline unsafe end" | "baseline unsafe center" | "baseline safe start" | "baseline safe end" | "baseline safe center" | "first baseline normal" | "first baseline stretch" | "first baseline baseline" | "first baseline first baseline" | "first baseline last baseline" | "first baseline start" | "first baseline end" | "first baseline center" | "first baseline unsafe start" | "first baseline unsafe end" | "first baseline unsafe center" | "first baseline safe start" | "first baseline safe end" | "first baseline safe center" | "last baseline normal" | "last baseline stretch" | "last baseline baseline" | "last baseline first baseline" | "last baseline last baseline" | "last baseline start" | "last baseline end" | "last baseline center" | "last baseline unsafe start" | "last baseline unsafe end" | "last baseline unsafe center" | "last baseline safe start" | "last baseline safe end" | "last baseline safe center" | "start normal" | "start stretch" | "start baseline" | "start first baseline" | "start last baseline" | "start start" | "start end" | "start center" | "start unsafe start" | "start unsafe end" | "start unsafe center" | "start safe start" | "start safe end" | "start safe center" | "end normal" | "end stretch" | "end baseline" | "end first baseline" | "end last baseline" | "end start" | "end end" | "end center" | "end unsafe start" | "end unsafe end" | "end unsafe center" | "end safe start" | "end safe end" | "end safe center" | "center normal" | "center stretch" | "center baseline" | "center first baseline" | "center last baseline" | "center start" | "center end" | "center center" | "center unsafe start" | "center unsafe end" | "center unsafe center" | "center safe start" | "center safe end" | "center safe center" | "unsafe start normal" | "unsafe start stretch" | "unsafe start baseline" | "unsafe start first baseline" | "unsafe start last baseline" | "unsafe start start" | "unsafe start end" | "unsafe start center" | "unsafe start unsafe start" | "unsafe start unsafe end" | "unsafe start unsafe center" | "unsafe start safe start" | "unsafe start safe end" | "unsafe start safe center" | "unsafe end normal" | "unsafe end stretch" | "unsafe end baseline" | "unsafe end first baseline" | "unsafe end last baseline" | "unsafe end start" | "unsafe end end" | "unsafe end center" | "unsafe end unsafe start" | "unsafe end unsafe end" | "unsafe end unsafe center" | "unsafe end safe start" | "unsafe end safe end" | "unsafe end safe center" | "unsafe center normal" | "unsafe center stretch" | "unsafe center baseline" | "unsafe center first baseline" | "unsafe center last baseline" | "unsafe center start" | "unsafe center end" | "unsafe center center" | "unsafe center unsafe start" | "unsafe center unsafe end" | "unsafe center unsafe center" | "unsafe center safe start" | "unsafe center safe end" | "unsafe center safe center" | "safe start normal" | "safe start stretch" | "safe start baseline" | "safe start first baseline" | "safe start last baseline" | "safe start start" | "safe start end" | "safe start center" | "safe start unsafe start" | "safe start unsafe end" | "safe start unsafe center" | "safe start safe start" | "safe start safe end" | "safe start safe center" | "safe end normal" | "safe end stretch" | "safe end baseline" | "safe end first baseline" | "safe end last baseline" | "safe end start" | "safe end end" | "safe end center" | "safe end unsafe start" | "safe end unsafe end" | "safe end unsafe center" | "safe end safe start" | "safe end safe end" | "safe end safe center" | "safe center normal" | "safe center stretch" | "safe center baseline" | "safe center first baseline" | "safe center last baseline" | "safe center start" | "safe center end" | "safe center center" | "safe center unsafe start" | "safe center unsafe end" | "safe center unsafe center" | "safe center safe start" | "safe center safe end" | "safe center safe center"A shorthand property for
justify-itemsandalign-items.row_gap(:string) - MaybeResponsive<"" | SpacingKeyword>Adjust spacing between elements in the block axis.
This overrides the row value of
gap.rowGapeither accepts:- a single SpacingKeyword value (e.g.
large-100) - OR a responsive value string with the supported SpacingKeyword as a query value.
- a single SpacingKeyword value (e.g.
Global attributes are accepted.
Slots
s_grid_item- See .s_grid_item for attributesDisplay content within a single item of a grid layout.