Lism Props
The props specific to Lism CSS that <Lism>-family components accept are called Lism Props.
as
Specifies the HTML tag or external component to render. Defaults to div.
<Lism as="p">Lorem ipsum texts...</Lism>
↓
<p>Lorem ipsum texts...</p>By specifying an external component, you can have <Lism> render as a different external component.
<Media> component using Next.js’s <Image>import Image from 'next/image';
<Media as={Image} src="..." p="20" bd />Lism Props (p and bd in the example above) are first processed to generate className and style, which are then passed to the component specified by as.
This is useful when you want to use Lism Props on non-Lism components.
lismClass
A dedicated slot for the component’s base c-- class (Component Class).
Classes passed here are also the target of BEM expansion by the variant prop.
BEM expansion is exclusively for c-- base classes. To attach a--* (atomic) or l--* (layout) classes, use the atomic / layout props described below.
<Lism p="10" lismClass="c--myComponent">Lorem ipsum texts...</Lism>
↓
<div class="c--myComponent -p:10">Lorem ipsum texts...</div>variant
Outputs a variation class for lismClass.
When multiple classes are specified in lismClass, the variation class is applied to the first class.
<Lism lismClass="c--myComponent" variant="secondary">Lorem ipsum texts...</Lism>
↓
<div class="c--myComponent c--myComponent--secondary">Lorem ipsum texts...</div>layout / atomic
layout and atomic are props for specifying Layout Primitive classes (l--*) and Atomic Primitive classes (a--*), respectively.
For example, specifying layout='flow' outputs the .l--flow class, and specifying atomic='divider' outputs the .a--divider class.
<Lism layout="flow">Lorem ipsum texts...</Lism><Lism atomic="divider" />
↓
<div class="l--flow">Lorem ipsum texts...</div><div class="a--divider"></div>Some layout / atomic values enable additional dedicated processing.
- Example 1:
layout="sideMain"acceptssideW/mainW - Example 2:
atomic="spacer"acceptsw/has space tokens
set / util
set specifies Set Class entries (set--{value}),
util specifies Utility Class entries (u--{value}).
<Lism set="shadow" util="cbox">...</Lism>
↓
<div class="set--shadow u--cbox">...</div>Multiple values
Both props accept space-separated values.
<Lism set="hov transition" util="cbox trim">...</Lism>Excluding with - prefix
Prefix a value with - to exclude that identifier. This is useful when you want to remove a class that has been applied internally by a component.
{/* Exclude set="plain" (set--plain) that MyButton applies by default */}<MyButton set="-plain">...</MyButton>
{/* Exclude u--trim and add u--cbox */}<MyCallout util="-trim cbox">...</MyCallout>Trait Props
A set of props corresponding to Trait Primitives classes.
| Prop | Output class | Purpose |
|---|---|---|
isWrapper(='{s|l}') | is--wrapper + -contentSize:{s|l} | Content width restriction |
isLayer | is--layer | Absolute positioned layer (inset:0) |
isBoxLink | is--boxLink | Make entire box clickable |
isCoverLink | is--coverLink | Link with a clickable area covering the parent element |
isContainer | is--container | Container query target |
isSide | is--side | Side element |
isSkipFlow | is--skipFlow | Skip Flow spacing |
isVertical | is--vertical | Vertical writing mode |
CSS Props
Major CSS properties can be specified using shorthand notation.
For example, font-size can be written as fz, and padding as p.
The output format is determined by the value (value) specified via prop={value}:
| Value | Output format | Example |
|---|---|---|
| Token / preset value | -{prop}:{value} class | fz='l' → -fz:l |
true / "-" | -{prop} class only (no variable) | bd → -bd |
Value starting with : | Forced utility class | p=':hoge' → -p:hoge |
| Other values (BP-supported) | -{prop} class + --{prop} variable | fz='20px' → -fz + --fz:20px |
| Other values (BP-unsupported) | Direct style attribute output | o='0.7' → opacity:0.7 |
| Other values (variable-only) | --{prop} variable only | bdw='2px' → --bdw:2px |
Notes
- BP-supported properties: Properties that can switch values at breakpoints. See the BP column in Property Class.
- Variable-only properties: Properties like
bds,bdc,bdw,keycolorthat always output only CSS variables (--{prop}). - When a matching token exists but has no dedicated class, the value is output as a CSS variable. (e.g.,
c='red'→class="-c"+style="--c:var(--red)")
Code examples
<Lism fz="l" p="20">...</Lism>// → <div class="-fz:l -p:20">...</div><Lism c="red">...</Lism>// → <div class="-c" style="--c:var(--red)">...</div>true / "-" → class only (no variable)<Lism p="-" bdrs>contents</Lism>// → <div class="-p -bdrs">contents</div>This is useful when you want to define the variable value in CSS, or when you want to inherit the same variable from a parent element.
<Lism bd bdc="#000" bdw="2px">...</Lism>// → <div class="-bd" style="--bdc:#000;--bdw:2px">...</div><Lism fz="20px">contents</Lism>// → <div class="-fz" style="--fz:20px">contents</div><Lism o="0.75">contents</Lism>// → <div style="opacity:0.75">contents</div>Force output as a class with :
Even if no corresponding Property Class exists, prefixing a value with : will output the string after it as a class name.
<Lism p=":hoge">...</Lism>// → <div class="-p:hoge">...</div>Add a custom class in your CSS and use it as needed.
.-p\:hoge { /* ... your styles ... */}Using className='-p:hoge' also works, but passing it as a CSS Prop via : ensures consistent output ordering.
Responsive syntax
BP-supported properties can specify values per breakpoint (sm, md) using arrays or objects.
Learn more about responsive support
<Lism p={['20', '30', '5rem']}>...</Lism>@md only)<Lism p={[null, null, '40']}>...</Lism>Whether a value actually changes at a breakpoint depends on whether that property supports responsive behavior. Check the BP (short for breakpoint) column in Property Class to see which properties are supported.
For properties that do not support responsive behavior by default (i.e., no CSS is provided), you can add support via SCSS customization.
exProps
Accepts props that you want to skip Lism Props processing for as an object.
This is handy when a prop name of the external component specified via as conflicts with a Lism Prop name, and you want to explicitly mark it as belonging to the external component.
<Icon as={Hoge} exProps={{ size: '1em' }} p="10" fz="l"> ...</Icon>By doing this, the Lism Icon component processes p and fz, while the external component Hoge reliably receives size.
(In this particular example, exProps is not strictly necessary since Lism does not currently process size, but explicitly marking external component props ensures no future conflicts.)
Class output order
The class attribute generated by <Lism> is output in the following order:
[className] [c--] [a--] [l--] [is--] [set--] [u--] [-]| # | Prop | Example |
|---|---|---|
| 1 | User-defined class (className) | z--header, hoge |
| 2 | lismClass (+ variant) | c--box, c--box--primary |
| 3 | atomic | a--icon, a--divider |
| 4 | layout | l--flex, l--columns |
| 5 | isXxxx | is--wrapper, is--layer |
| 6 | set | set--hov, set--transition |
| 7 | util | u--cbox, u--trim |
| 8 | prop={value} | -p:20, -bgc:base-2 |
The -flow:{size} class produced by layout="flow" is treated as a layout-primitive-specific configuration class, so it is emitted alongside the primitive group right after l--flow.
The order within the class attribute does not affect the CSS cascade (specificity or cascade order). This ordering exists purely for readability and consistency.