Search

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.

Example of specifying an HTML tag
<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.

Example: rendering Lism’s <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.

Example
<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.

Example
<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.

Example
<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" accepts sideW / mainW
  • Example 2: atomic="spacer" accepts w / h as space tokens

set / util

set specifies Set Class entries (set--{value}),
util specifies Utility Class entries (u--{value}).

Example
<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.

PropOutput classPurpose
isWrapper(='{s|l}')is--wrapper + -contentSize:{s|l}Content width restriction
isLayeris--layerAbsolute positioned layer (inset:0)
isBoxLinkis--boxLinkMake entire box clickable
isCoverLinkis--coverLinkLink with a clickable area covering the parent element
isContaineris--containerContainer query target
isSideis--sideSide element
isSkipFlowis--skipFlowSkip Flow spacing
isVerticalis--verticalVertical 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}:

ValueOutput formatExample
Token / preset value-{prop}:{value} classfz='l'-fz:l
true / "-"-{prop} class only (no variable)bd-bd
Value starting with :Forced utility classp=':hoge'-p:hoge
Other values (BP-supported)-{prop} class + --{prop} variablefz='20px'-fz + --fz:20px
Other values (BP-unsupported)Direct style attribute outputo='0.7'opacity:0.7
Other values (variable-only)--{prop} variable onlybdw='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, keycolor that 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

Token value → class only
<Lism fz="l" p="20">...</Lism>
// → <div class="-fz:l -p:20">...</div>
Color token (no dedicated class) → class + CSS variable
<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.

Variable-only property → CSS variable only
<Lism bd bdc="#000" bdw="2px">...</Lism>
// → <div class="-bd" style="--bdc:#000;--bdw:2px">...</div>
BP-supported property with custom value → class + CSS variable
<Lism fz="20px">contents</Lism>
// → <div class="-fz" style="--fz:20px">contents</div>
BP-unsupported property with custom value → direct style output
<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

Example 1: array syntax (base → sm → md)
<Lism p={['20', '30', '5rem']}>...</Lism>
Example 2: skip intermediate breakpoints (@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.

Example
<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--] [-]
#PropExample
1User-defined class (className)z--header, hoge
2lismClass (+ variant)c--box, c--box--primary
3atomica--icon, a--divider
4layoutl--flex, l--columns
5isXxxxis--wrapper, is--layer
6setset--hov, set--transition
7utilu--cbox, u--trim
8prop={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.

© Lism CSS. All rights reserved.