stroke

Class Description

stroke

Sets SVG stroke color via --stroke.

CSS Rules

.stroke {
  stroke: var(--stroke);
}

Usage

The .stroke class is flagged as a value-driven selector. The variable --stroke is required.
<element class="stroke" style="--stroke: /* value */;" />

Responsive & Dark Mode

Prefix .stroke utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl). If dark mode is applied, the dark: prefix always comes first.

<element class="md:stroke" style="--md-stroke: /* value */;" />

<element class="dark:sm:stroke" style="--dark-sm-stroke: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints and dark mode.

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="stroke:hover" style="--stroke-hover: /* value */;" />

<element class="dark:sm:stroke:hover" style="--dark-sm-stroke-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="stroke:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before stroke::before" style="--stroke-before: /* value */;" />

<element class="content-after stroke::after" style="--stroke-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="stroke=value" />

<!-- Output -->
<element class="stroke" style="--stroke: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.stroke Sets SVG stroke color via --stroke.

stroke/o

Sets SVG stroke color + opacity via --stroke and --stroke-o.

CSS Rules

.stroke\/o {
  stroke: color-mix(in oklab, var(--stroke) var(--stroke-o, 100%), transparent);
}

Usage

The .stroke/o class is flagged as a value-driven selector. The variables --stroke and --stroke-o are required.
<element
  class="stroke/o"
  style="
    --stroke: /* value */;
    --stroke-o: /* value */;
  "
></element>

Responsive & Dark Mode

Prefix .stroke/o utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl). If dark mode is applied, the dark: prefix always comes first.

<element
  class="md:stroke/o"
  style="
    --md-stroke: /* value */;
    --md-stroke-o: /* value */;
  "
></element>

<element
  class="dark:sm:stroke/o"
  style="
    --dark-sm-stroke: /* value */;
    --dark-sm-stroke-o: /* value */;
  "
></element>

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints and dark mode.

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element
  class="stroke/o:hover"
  style="
    --stroke-hover: /* value */;
    --stroke-o-hover: /* value */;
  "
></element>

<element
  class="dark:sm:stroke/o:hover"
  style="
    --dark-sm-stroke-hover: /* value */;
    --dark-sm-stroke-o-hover: /* value */;
  "
></element>

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="stroke/o:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element
  class="content-before stroke/o::before"
  style="
    --stroke-before: /* value */;
    --stroke-o-before: /* value */;
  "
></element>

<element
  class="content-after stroke/o::after"
  style="
    --stroke-after: /* value */;
    --stroke-o-after: /* value */;
  "
></element>

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="stroke/o=value" />

<!-- Output -->
<element class="stroke/o" style="--stroke: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.stroke/o Sets SVG stroke color + opacity via --stroke and --stroke-o.