---
title: Item
description: A row of a title, a line of text under it, media before it and controls at its end, alone or in a bordered group.
visibility: guest
draft: false
---

# Item

Settings screens, member lists and account pages are made of one row: a title, a sentence under it, sometimes an avatar or an icon before it, and a button, a switch or a value at its end. `item` is that row, and `item.group` stacks several of them into one bordered list with a rule between them.

:::preview{title="An item with a description and an action"}
<x-wirekit::item
    title="Two-factor authentication"
    description="Ask for a code from an app on your phone at every sign-in."
>
    <x-slot:actions>
        <x-wirekit::button size="sm">Set up</x-wirekit::button>
    </x-slot:actions>
</x-wirekit::item>
:::

## Without a description

The description is optional. Without it the item is a single line, and it is still as tall as a small button, so a row with a button and a row without one stand at the same height.

:::preview{title="Single-line items, with a value and with a button"}
<x-wirekit::item.group label="Plan">
    <x-wirekit::item title="Plan">
        <x-slot:actions>
            <x-wirekit::badge intent="success">Pro</x-wirekit::badge>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Invoices">
        <x-slot:actions>
            <x-wirekit::button size="sm">Download</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

## Actions

The `actions` slot sits at the end of the row, centered on the title and the description beside it. Several controls stand side by side and wrap among themselves when the row runs out.

:::preview{title="A badge and two buttons side by side"}
<x-wirekit::item title="Production API key" description="Created on March 4. Used two hours ago.">
    <x-slot:actions>
        <x-wirekit::badge>Live</x-wirekit::badge>
        <x-wirekit::button size="sm">Rotate</x-wirekit::button>
        <x-wirekit::button size="sm" intent="danger" surface="outline" icon-only>
            <x-slot:iconLeft><x-wirekit::icon name="trash" size="sm" aria-hidden="true" /></x-slot:iconLeft>
            Revoke key
        </x-wirekit::button>
    </x-slot:actions>
</x-wirekit::item>
:::

## Media

The `media` slot leads the row: an avatar, an icon tile or anything else that says what the row is about. It sits at the start, centered on the text beside it.

:::preview{title="An avatar and an icon tile before the text"}
<x-wirekit::item.group label="Examples with media">
    <x-wirekit::item title="Ada Lovelace">
        <x-slot:description>ada&#64;example.com</x-slot:description>
        <x-slot:media>
            <x-wirekit::avatar initials="AL" alt="" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::badge>Owner</x-wirekit::badge>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Weekly summary" description="A mail every Monday with what changed last week.">
        <x-slot:media>
            <x-wirekit::icon-tile icon="inbox" />
        </x-slot:media>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

## Groups

`item.group` draws one frame around its items and a rule between them, and an item inside it draws no frame of its own. The group is a list for assistive technology, so give it a name with `label`: a settings screen with a group per section otherwise reads as a run of identical lists.

:::preview{title="Three items in a group"}
<x-wirekit::item.group label="Security">
    <x-wirekit::item title="Password" description="Last changed three months ago.">
        <x-slot:actions>
            <x-wirekit::button size="sm">Change</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Two-factor authentication" description="On, with an authenticator app.">
        <x-slot:actions>
            <x-wirekit::badge intent="success">On</x-wirekit::badge>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Active sessions" description="Signed in on two devices.">
        <x-slot:actions>
            <x-wirekit::button size="sm">Review</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

## Narrow widths

On a narrow item a labeled button moves under the text, so the title keeps its width. A switch, a badge, a value, a menu and an icon button stay at the end of the row, where they fit beside a short title.

The item goes by its own width, not the window's: below 24rem of item the button moves, so an item in a modal, in a sidebar or in a column of a grid does the same as one on a phone.

:::preview{title="Two items in two columns: the button moves under the text, the switch stays"}
<x-wirekit::grid cols="1 md:2">
    <x-wirekit::item title="Backups" description="A copy of every project each night.">
        <x-slot:actions>
            <x-wirekit::button size="sm">Restore</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Sign-in alerts" description="A mail for every sign-in from a new device." for="narrow-sign-in-alerts">
        <x-slot:actions>
            <x-wirekit::toggle id="narrow-sign-in-alerts" name="sign_in_alerts" checked aria-describedby="narrow-sign-in-alerts-description" />
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::grid>
:::

`stack-below` moves every action under the text below the width it names, whatever the actions hold:

```blade
<x-wirekit::item title="Storage" description="12 GB of 50 GB used." stack-below="md">
    <x-slot:actions>
        <x-wirekit::badge>Pro</x-wirekit::badge>
        <x-wirekit::button size="sm">Upgrade</x-wirekit::button>
    </x-slot:actions>
</x-wirekit::item>
```

::: warning
**The width is the item's own, and the scale says so.** `stack-below` reads Tailwind's **container** ladder, which shares its names with the viewport one and not its meanings: `stack-below="sm"` is 24rem of **item**, where a viewport `sm` is 40rem of **window**. Pick the size from how wide the item itself gets, never from a screen width.
:::

## Naming a switch with its title

A switch at the end of a row needs a name, and the title beside it already says it. `for` takes the id of the control in `actions` and renders the title as its `<label>`: a screen reader announces the switch by the visible title, and a click on the title flips it.

With `for`, the description gets the id `{for}-description`, so the control can name it with `aria-describedby` without an id being made up for it.

:::preview{title="A switch named by its title and described by its description"}
<x-wirekit::item
    title="Desktop notifications"
    description="A banner for every new message while the app is open."
    for="desktop-notifications"
>
    <x-slot:actions>
        <x-wirekit::toggle id="desktop-notifications" name="desktop_notifications" checked aria-describedby="desktop-notifications-description" />
    </x-slot:actions>
</x-wirekit::item>
:::

::: warning
**`for` is for a form control: a switch, a checkbox, a select or an input.** Never point it at a button: a `<label>` in front of a button presses that button on every click on the title, and a button names itself with its own label. A control named by the title must not take a `label` of its own, or a screen reader hears the name twice.
:::

## A title that starts a section

The title is not a heading, so a list of thirty members does not put thirty entries into the outline of the page. `level` makes it a heading of that level, for a row that is a section of its own.

:::preview{title="A danger zone as a section of a settings screen"}
<x-wirekit::item
    level="3"
    title="Delete this workspace"
    description="Every project, member and invoice is deleted. This cannot be undone."
>
    <x-slot:actions>
        <x-wirekit::button size="sm" intent="danger">Delete workspace</x-wirekit::button>
    </x-slot:actions>
</x-wirekit::item>
:::

## Inside a card

A card draws a frame of its own, and an item or a group inside it would draw a second one. `surface="ghost"` draws neither the frame nor the background and keeps the rules between the rows of a group. Put the group in a `card.body` with `:padded="false"`: each item brings its own padding, and the rules between the rows reach the edges of the card.

:::preview{title="A group without its own frame inside a card"}
<x-wirekit::card>
    <x-wirekit::card.header>
        <x-wirekit::heading level="2" size="base">Preferences</x-wirekit::heading>
    </x-wirekit::card.header>
    <x-wirekit::card.body :padded="false">
        <x-wirekit::item.group label="Preferences" surface="ghost">
            <x-wirekit::item title="Language">
                <x-slot:actions>
                    <x-wirekit::text size="sm" intent="muted">English</x-wirekit::text>
                </x-slot:actions>
            </x-wirekit::item>
            <x-wirekit::item title="Time zone">
                <x-slot:actions>
                    <x-wirekit::text size="sm" intent="muted">Europe/Berlin</x-wirekit::text>
                </x-slot:actions>
            </x-wirekit::item>
        </x-wirekit::item.group>
    </x-wirekit::card.body>
</x-wirekit::card>
:::

## In a form

Alone, a `ghost` item keeps no padding either, so a switch row lines up with the fields above it instead of standing a step inside them.

:::preview{title="A switch row in a form, lined up with the field above it"}
<x-wirekit::stack gap="md">
    <x-wirekit::field label="Product name" name="product_name">
        <x-wirekit::input name="product_name" value="Merino crew" />
    </x-wirekit::field>
    <x-wirekit::item
        title="Show on storefront"
        description="Visible to customers as soon as it is saved."
        for="form-show-on-storefront"
        surface="ghost"
    >
        <x-slot:actions>
            <x-wirekit::toggle id="form-show-on-storefront" name="visible" checked aria-describedby="form-show-on-storefront-description" />
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::stack>
:::

## Examples

### Team members

:::preview{title="Members with their role in a menu"}
<x-wirekit::item.group label="Team members">
    <x-wirekit::item title="Ada Lovelace">
        <x-slot:description>ada&#64;example.com</x-slot:description>
        <x-slot:media>
            <x-wirekit::avatar initials="AL" alt="" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::dropdown>
                <x-wirekit::dropdown.trigger>
                    <x-wirekit::button size="sm" surface="ghost">Admin</x-wirekit::button>
                </x-wirekit::dropdown.trigger>
                <x-wirekit::dropdown.panel label="Role of Ada Lovelace">
                    <x-wirekit::dropdown.item>Admin</x-wirekit::dropdown.item>
                    <x-wirekit::dropdown.item>Member</x-wirekit::dropdown.item>
                    <x-wirekit::dropdown.item>Viewer</x-wirekit::dropdown.item>
                </x-wirekit::dropdown.panel>
            </x-wirekit::dropdown>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Grace Hopper">
        <x-slot:description>grace&#64;example.com</x-slot:description>
        <x-slot:media>
            <x-wirekit::avatar initials="GH" alt="" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::badge>Owner</x-wirekit::badge>
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

### Connected apps

:::preview{title="Apps with access, when each was last used, and a menu to disconnect it"}
<x-wirekit::item.group label="Connected apps">
    <x-wirekit::item title="Code host" description="Last used today.">
        <x-slot:media>
            <x-wirekit::icon-tile icon="code" intent="neutral" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::dropdown>
                <x-wirekit::dropdown.trigger>
                    <x-wirekit::button size="sm" surface="ghost" icon-only>
                        <x-slot:iconLeft><x-wirekit::icon name="more" size="sm" aria-hidden="true" /></x-slot:iconLeft>
                        Options for the code host
                    </x-wirekit::button>
                </x-wirekit::dropdown.trigger>
                <x-wirekit::dropdown.panel label="Options for the code host">
                    <x-wirekit::dropdown.item danger>Disconnect</x-wirekit::dropdown.item>
                </x-wirekit::dropdown.panel>
            </x-wirekit::dropdown>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Team chat" description="Last used three weeks ago.">
        <x-slot:media>
            <x-wirekit::icon-tile icon="message" intent="neutral" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::dropdown>
                <x-wirekit::dropdown.trigger>
                    <x-wirekit::button size="sm" surface="ghost" icon-only>
                        <x-slot:iconLeft><x-wirekit::icon name="more" size="sm" aria-hidden="true" /></x-slot:iconLeft>
                        Options for the team chat
                    </x-wirekit::button>
                </x-wirekit::dropdown.trigger>
                <x-wirekit::dropdown.panel label="Options for the team chat">
                    <x-wirekit::dropdown.item danger>Disconnect</x-wirekit::dropdown.item>
                </x-wirekit::dropdown.panel>
            </x-wirekit::dropdown>
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

### Billing

:::preview{title="The plan, its price and the payment method"}
<x-wirekit::item.group label="Billing">
    <x-wirekit::item title="Plan" description="Pro, billed yearly.">
        <x-slot:actions>
            <x-wirekit::text size="sm" weight="medium">€240 a year</x-wirekit::text>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Payment method" description="Card ending in 4242, expires 08/28.">
        <x-slot:media>
            <x-wirekit::icon-tile icon="credit-card" intent="neutral" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::button size="sm">Update</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

### Teams

:::preview{title="The teams a person belongs to"}
<x-wirekit::item.group label="Teams">
    <x-wirekit::item title="Design" description="Eight members.">
        <x-slot:media>
            <x-wirekit::icon-tile icon="users" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::badge intent="success">Current</x-wirekit::badge>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Platform" description="Fourteen members.">
        <x-slot:media>
            <x-wirekit::icon-tile icon="cube" />
        </x-slot:media>
        <x-slot:actions>
            <x-wirekit::button size="sm">Switch</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

### Notifications

:::preview{title="Switches named by their titles"}
<x-wirekit::item.group label="Notifications">
    <x-wirekit::item title="Mentions" description="When someone mentions you in a comment." for="notify-mentions">
        <x-slot:actions>
            <x-wirekit::toggle id="notify-mentions" name="notify_mentions" checked aria-describedby="notify-mentions-description" />
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Weekly digest" description="A summary of the week, every Monday morning." for="notify-digest">
        <x-slot:actions>
            <x-wirekit::toggle id="notify-digest" name="notify_digest" aria-describedby="notify-digest-description" />
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item title="Product news" description="New features, at most once a month." for="notify-news">
        <x-slot:actions>
            <x-wirekit::toggle id="notify-news" name="notify_news" aria-describedby="notify-news-description" />
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

### Danger zone

:::preview{title="Leaving and deleting, each a section of its own"}
<x-wirekit::item.group label="Danger zone">
    <x-wirekit::item level="3" title="Leave the workspace" description="You lose access to its projects until someone invites you again.">
        <x-slot:actions>
            <x-wirekit::button size="sm">Leave</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
    <x-wirekit::item level="3" title="Delete the workspace" description="Every project, member and invoice is deleted. This cannot be undone.">
        <x-slot:actions>
            <x-wirekit::button size="sm" intent="danger">Delete</x-wirekit::button>
        </x-slot:actions>
    </x-wirekit::item>
</x-wirekit::item.group>
:::

## Configuration

`surface` reads its default from the config, for an item that stands alone and for a group alike. Override it in `config/wirekit.php`:

```php
'components' => [
    'item' => ['surface' => 'ghost'],
],
```

## Personalization blocks

The parts of the row are resolvable through [`WireKit::personalize()`](/customization) / [`WireKit::scope()`](/customization), and a config override under `components.item.classes.{block}` reaches the same keys:

| Block key | Applies to |
| --- | --- |
| `item.base` | The item itself: its container query, width, padding and text color |
| `item.surface` | The frame, background and corners of an item that stands alone with `surface="outline"` |
| `item.row` | The grid of the media, the text and the actions, its gaps and its minimum height |
| `item.media` | The cell of the `media` slot |
| `item.content` | The cell of the title and the description |
| `item.actions` | The `actions` slot, its alignment and the gap between its controls |
| `item.title` | The title's size, weight and color |
| `item-group.base` | The group's list, its rules between rows and, with `surface="outline"`, its frame |

## Props

### `item`

| Prop | Type | Default | Description |
|---|---|---|---|
| `title` | `string\|null` | `null` | The row's title. The default slot says the same thing and wins when both are given |
| `description` | `string\|null` | `null` | A line of supporting text under the title. A `description` slot takes the same place when the text needs markup |
| `level` | `int\|null` | `null` | Render the title as a heading of this level, `1` to `6`. Without it the title is not a heading — see [A title that starts a section](#a-title-that-starts-a-section) |
| `for` | `string\|null` | `null` | The id of the form control in `actions` that the title names; the title renders as its `<label>` — see [Naming a switch with its title](#naming-a-switch-with-its-title) |
| `title-id` | `string\|null` | `null` | The title's id. With `for` it defaults to `{for}-title` |
| `description-id` | `string\|null` | `null` | The description's id. With `for` it defaults to `{for}-description` |
| `stack-below` | `string\|null` | `null` | Put every action under the text below a width of the **item**: `'sm'`, `'md'`, `'lg'`, `'xl'`, `'2xl'` or `'3xl'` on Tailwind's **container** ladder — see [Narrow widths](#narrow-widths) |
| `surface` | `string` | `'outline'` | `outline` draws a frame with rounded corners on the elevated background. `ghost` draws neither and, on an item alone, no padding, so it lines up with what stands beside it — see [In a form](#in-a-form). Inside a group the group draws the surface, every row keeps its padding, and this prop has no effect |
| `scope` | `string\|null` | `null` | Theme scope, as everywhere else |

### `item.group`

| Prop | Type | Default | Description |
|---|---|---|---|
| `label` | `string\|null` | `null` | The list's accessible name. `aria-label` or `aria-labelledby` on the tag take its place |
| `surface` | `string` | `'outline'` | `outline` draws one frame around all of the rows, `ghost` only the rules between them |
| `scope` | `string\|null` | `null` | Theme scope, as everywhere else |

## Slots

| Slot | Description |
|---|---|
| default | The title, when it carries markup |
| `description` | The line under the title, when it carries markup |
| `media` | An avatar, an icon tile or anything else that leads the row |
| `actions` | Buttons, a switch, a badge, a value or a menu, at the end of the row |

## Accessibility

- An item in a group is an `<li>` of a `<ul role="list">`. The role is there on purpose: Safari drops the semantics of a list drawn without markers
- Name each group with `label`, or point `aria-labelledby` at a heading above it. A screen with several unnamed lists reads as a run of "list, 3 items"
- `for` makes the visible title the name of the switch, checkbox, select or input in `actions`, and `aria-describedby="{for}-description"` adds the description to what is announced with it
- The title is a heading only with `level`. Set it where a row is a section of the page, not on every row of a list
- An icon button in `actions` keeps its label visually hidden with `icon-only`, so it still has a name

## Keyboard Interaction

The item renders no interactive element of its own: it is a title, a line of text and whatever you put in `media` and `actions`. Those controls keep their own keyboard behavior and their own place in the tab order, in the order the markup puts them.

## See Also

- [Page Header](page-header.md) — the one title of a screen, with its own actions
- [Data List](data-list.md) — a list of keys and their values
- [Toggle](toggle.md) — the switch a settings row usually holds
- [Card](card.md) — the frame a group of items often sits in
