Wrapper (is--wrapper)
is--wrapper is a class that collectively controls the width of its direct child content.
CSS
.is--wrapper {
// 子要素の制御
--contentSize: var(--sz--m, 100%);
> * {
inline-size: 100%; // l--stack 等の縦並び配下で自然幅要素のガタつきを防ぐ
max-inline-size: min(100%, var(--contentSize)); // min ないとimg要素等がはみ出す
margin-inline: auto;
}
}
// Memo: .-contentSize:s / m / l / xl は contentSize Prop の auto-generated 出力(src/scss/_prop-config.scss 経由)から自動的に props 層に出力される。 Direct children receive inline-size: 100%, so even elements whose natural width is below --contentSize (short paragraphs, <table>, etc.) always stretch to the parent width. This keeps widths consistent under l--stack and other vertical layouts and prevents jagged edges.
A <table> that is a direct child of is--wrapper loses its content-driven natural width — it always stretches to fill the wrapper. To preserve the table’s intrinsic width, wrap it in another element so it is no longer a direct child of is--wrapper.
Using with Lism Components
It can be applied via the isWrapper prop on any component.
| Prop | Output |
|---|---|
isWrapper | is--wrapper |
isWrapper='s' | is--wrapper, -contentSize:s |
isWrapper='m' | is--wrapper, -contentSize:m |
isWrapper='l' | is--wrapper, -contentSize:l |
isWrapper='xl' | is--wrapper, -contentSize:xl |
isWrapper={value} | is--wrapper, --contentSize:{value} |
A dedicated <Wrapper> component is also available as an alias for <Lism isWrapper>.
Import
import { Wrapper } from 'lism-css/react'; Props
| Prop | Description |
|---|---|
contentSize | Specifies the content size. |
layout | Specifies the Layout Primitive to expand into. |
isContainer | Sets the container type. |
// ①<Flow isWrapper="s" isContainer>...</Flow>
// ②<Wrapper contentSize="s" layout="flow" isContainer>...</Wrapper>Usage
Example
Content
Content
…
<Wrapper layout="flow" p="20"> <p>Content</p> <p>Content</p> <p>...</p></Wrapper>contentSize='s'Content
Content
…
<Wrapper contentSize="s" layout="flow" p="20"> <p>Content</p> <p>Content</p> <p>...</p></Wrapper>Setting a custom container size
To use a value other than s, m, l, or xl, pass any value to isWrapper and it will be output as the --contentSize CSS variable.
<Lism isWrapper="20rem" p="20"> <div>Contents...</div> <div>Contents...</div></Lism>Demo Page
A demo page is available where you can explore the behavior of is--wrapper.
We recommend viewing it on a wide screen.