Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Data display

ListItem

Row in a List: a title and description, with optional leading and trailing content. With href or onClick it's a link or button.

import { ListItem } from "@stylhero/ui";

Example

Code
import { List, ListItem, CheckCircleIcon } from "@stylhero/ui";

function ListItemExample() {
  return (
    <List>
      <ListItem title="Link row" description="Has href" href="#props" selected />
      <ListItem title="Button row" description="Has onClick" onClick={() => {}} trailing={<CheckCircleIcon />} />
    </List>
  );
}

Props

PropTypeDefaultDescription
title required ReactNode -
description ReactNode -
disabled boolean -
href string - Makes the whole row a link.
leading ReactNode - Left side: an Avatar, icon or Checkbox.
onClick () => void -
selected boolean - Highlights the row (e.g. the open conversation).
trailing ReactNode - Right side: a Badge, value or IconButton.

Also takes every <li> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.

Keyboard

KeyDoes
Enter / SpaceActivates it when it has href or onClick

Accessibility

  • With href it's a link (aria-current when selected); with onClick a button (aria-pressed).

Generated from src/components/List.tsx. Something wrong or missing? Open an issue.