Kombai Logo

Tailwind CSS List Style Type

The CSS property list-style-type defines the marker type used for lists. It determines the appearance of bullets or numbering for ordered and unordered lists. Tailwind CSS offers an extensive set of utility classes to directly apply these styling properties without writing custom CSS. These utilities allow you to efficiently manage list-style-type with a highly functional and scalable approach.

Whether you're crafting detailed bullet points, hierarchical numbering, or custom-themed lists, Tailwind CSS makes it intuitive to implement and customize these stylings.

ClassPropertiesExample
list-nonelist-style-type: none;<div className="list-none"></div>
list-disclist-style-type: disc;<div className="list-disc"></div>
list-decimallist-style-type: decimal;<div className="list-decimal"></div>

Overview of List Style Type

Styling the List Type

Tailwind provides disc and decimal list marker styles tailored for unordered or ordered lists.

Here, the class list-disc applies a circular bullet style:

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Here's another example of list-decimal that applies numbered bullets:

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

States and Responsiveness

Hover and Focus States

When building dynamic applications, there are situations where you'd want a list's style to change based on user interaction, such as hover or focus.

In this snippet, a default disc list type changes into decimal when hovered:

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Breakpoint Modifiers

Tailwind's list-style-type utilities integrate seamlessly with breakpoint modifiers like sm, md, lg, etc. This ensures your list styles can adapt to various screen sizes.

Here, you see list markers dynamically transforming based on the screen size, enabling more flexible designs.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Custom List Style Type

Sometimes you might want the list-style-type property to deviate from Tailwind's predefined marker styles. Tailwind allows you to extend its configuration or directly define arbitrary values.

Extending the Theme

Tailwind's design system is easily adjustable. You can add unique list-style markers to the theme configuration file (tailwind.config.js), targeting specific projects.

Once added, these marker types become available as utility classes.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Notice the implementation of a custom triangular bullet added via a Tailwind extension.

Using Arbitrary Values

If you need to implement a unique marker for a one-off case, Tailwind's support for arbitrary values allows you to apply precise CSS directly to list-style-type.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Real World Examples

Product Feature List with Custom Decimal Markers

This component displays product features with custom decimal markers, ideal for showcasing key selling points of a software application.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Recipe Instructions with Roman Numerals

A component that displays cooking instructions using Roman numerals for a sophisticated cooking app interface.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Travel Checklist with Custom Bullets

A travel preparation checklist using custom bullet styles and category grouping.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

E-commerce Size Guide with Square Bullets

A size guide component for clothing items using square bullets and responsive design.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Project Timeline with Custom Markers

A project timeline component using custom markers and progressive styling.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Customization Examples

Custom Resume Bullet Points

This example demonstrates how to create a custom resume-style list with unique bullet points for different sections.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Interactive Documentation Menu

This example shows how to create an interactive documentation menu with custom list styles that change on hover.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Feature Comparison List

This example demonstrates how to create a feature comparison list with custom markers for different status types.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Best Practices

Maintain Design Consistency

Always ensure that your use of list-style-type is consistent across components. This means using predefined or custom markers that align with your design system's typography and branding. For instance, when working on a product catalog, the use of consistent list-disc or custom markers, such as list-star, provides uniformity and clarity.

For complex systems, extend the default markers in Tailwind's configuration file to standardize custom styles like arrows or triangles. By maintaining this standard across your designs, not only does it provides a better user experience, but it also makes your project easier to maintain as the team scales.

Balance with Other Layout Properties

Integrating list-style-type with layout utilities ensures your lists feel naturally integrated into your overall design. Pairing list-disc with flex or grid layouts allows lists to serve different UX needs, such as formatted pricing tables or aligned feature lists. Use spacing utilities like space-y- and gap- to balance alignment and ensure readability.

For instance, an e-commerce feature list with structured headers and markers can be built using list-none, grid utilities, and responsive typography. Experiment with using grid columns in conjunction with list markers to highlight the contents of each item.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Accessibility Considerations

Enhance Readability and Navigability

Using well-defined list styles improves content hierarchy, which is particularly advantageous for users navigating with assistive technologies. For instance, unordered lists help screen readers articulate grouped information, while ordered list markers can clarify the sequence in procedural content.

To maximize readability, pair list-decimal for numerical sequences or logical steps with sufficient padding and text utilities for font size accessibility. Consider the clarity of custom markers or icons used—ensuring they are distinctly recognizable when magnified or zoomed.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Focus on High Contrast

For inclusive accessibility, always maintain adequate contrast between markers and backgrounds. Tailwind's marker:text-color class can ensure that markers stand out against surrounding text and backgrounds. Pairing high-contrast markers with distinct list item spacing facilitates easier content scannability for low-vision users.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}