sdxc

[ @sdxc/u/general ]

list-style

Applies list-style.

import { listStyle } from "@sdxc/u/general";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.listStyle()css({ listStyle: "none" })
u.listStyle("decimal")css({ listStyle: "decimal" })

Examples

Basic example

Use listStyle("disc") or listStyle("decimal") to draw bullets or numbers beside list items, and listStyle() to remove them:

listStyle()

  • Passport
  • Charger
  • Rain jacket

listStyle("disc")

  • Passport
  • Charger
  • Rain jacket

listStyle("decimal")

  1. Passport
  2. Charger
  3. Rain jacket
<div mix={[grid(), gridTemplate({ columns: "repeat(3, auto)" }), gap(10)]}>
	<div>
		<p mix={[...]}>listStyle()</p>
		<ul mix={[listStyle()]}>
			<li>Passport</li>
			<li>Charger</li>
			<li>Rain jacket</li>
		</ul>
	</div>
	<div>
		<p mix={[...]}>listStyle("disc")</p>
		<ul mix={[listStyle("disc"), pis(5)]}>
			<li>Passport</li>
			<li>Charger</li>
			<li>Rain jacket</li>
		</ul>
	</div>
	<div>
		<p mix={[...]}>listStyle("decimal")</p>
		<ol mix={[listStyle("decimal"), pis(5)]}>
			<li>Passport</li>
			<li>Charger</li>
			<li>Rain jacket</li>
		</ol>
	</div>
</div>

Other markers

Pass any list-style value, like a counter style, a position or a quoted string to use as the marker:

listStyle("lower-roman")

  1. Preface
  2. Methods
  3. Results

listStyle("square inside")

  • Preface
  • Methods
  • Results

listStyle('"✓ "')

  • Preface
  • Methods
  • Results
<div mix={[grid(), gridTemplate({ columns: "repeat(3, auto)" }), gap(10)]}>
	<div>
		<p mix={[...]}>listStyle("lower-roman")</p>
		<ol mix={[listStyle("lower-roman"), pis(6)]}>
			<li>Preface</li>
			<li>Methods</li>
			<li>Results</li>
		</ol>
	</div>
	<div>
		<p mix={[...]}>listStyle("square inside")</p>
		<ul mix={[listStyle("square inside"), ...]}>
			<li>Preface</li>
			<li>Methods</li>
			<li>Results</li>
		</ul>
	</div>
	<div>
		<p mix={[...]}>listStyle('"✓ "')</p>
		<ul mix={[listStyle('"✓ "'), pis(5)]}>
			<li>Preface</li>
			<li>Methods</li>
			<li>Results</li>
		</ul>
	</div>
</div>

Applying on a state

Wrap the call in a state utility to scope it to one selector.

u.hover(u.listStyle())

Responsive design

Wrap the call in a container query to scope it to one width.

u.at("md", u.listStyle())

Signature

u.listStyle(value?: ListStyleValue)

Written by Sergio Xalambrí. Follow @sergiodxa for new packages, or sponsor the work.