Skip to main content
Decoderen
Browse documentation

CheckList

List concise capabilities or supporting statements as a Material 3 list: a leading check and a hairline divider per row.

Single entry

  • One concise statement
Show code
Example.astroAstro
---
import CheckList from '@dhekode/ui/patterns/CheckList.tsx';
---

<CheckList items={["One concise statement"]} />

Multiple entries

  • Visible labels
  • Readable text
  • Useful context
Show code
Example.astroAstro
---
import CheckList from '@dhekode/ui/patterns/CheckList.tsx';
---

<CheckList items={["Visible labels", "Readable text", "Useful context"]} />
API reference
items

Type: readonly string[]

Default: required

Plain text statements.

class

Type: string | undefined

Default: unset

Adds a class to the component root; keep feature styling scoped.

Slots: None.

This is a content list, not a checkbox input or an interactive task list.

Original component source
packages/ui/src/patterns/CheckList.tsxAstro
import Icon from '@dhekode/icons/Icon.tsx';
import { classNames } from '@dhekode/utils/class-names';

export interface CheckListProps {
  items: readonly string[];
  className?: string | undefined;
}

/**
 * Short capability statements as a Material 3 list: each row leads with a check and sits above
 * a hairline divider, in two columns from small screens.
 */
export default function CheckList({ items, className }: CheckListProps) {
  return (
    <ul
      role="list"
      className={classNames(
        'dk-check-list grid grid-cols-1 gap-x-gutter sm:grid-cols-2',
        className,
      )}
    >
      {items.map((item) => (
        <li
          key={item}
          className="dk-reveal-item flex min-h-(--dk-layout-control-height-lg) items-center gap-md border-b-(length:--dk-border-width-hairline) border-solid border-surface-border py-sm only:col-span-full"
        >
          <Icon name="check" className="text-surface-accent" />
          <span className="min-w-0 wrap-anywhere">{item}</span>
        </li>
      ))}
    </ul>
  );
}