Item
A flexible layout for list rows: media, content (title, description), actions, plus full-width header and footer rows; grouped with separators, as a container, link or button.
Preview
<x-ui.item variant="outline">
<x-ui.item.media variant="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M2 7a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2z" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Project Alpha') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Updated 2 hours ago') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.button variant="outline" size="sm">{{ __('View') }}</x-ui.button>
</x-ui.item.actions>
</x-ui.item>
Variant options
Size options
Installation
php artisan ui:add item
Registry contract
php artisan ui:add item
writes only the files below. The CLI validates each file hash before writing and asks before it replaces a local change, unless you pass --force.
-
resources/views/components/ui/item.blade.php -
resources/views/components/ui/item/group.blade.php -
resources/views/components/ui/item/media.blade.php -
resources/views/components/ui/item/content.blade.php -
resources/views/components/ui/item/title.blade.php -
resources/views/components/ui/item/description.blade.php -
resources/views/components/ui/item/actions.blade.php -
resources/views/components/ui/item/separator.blade.php -
resources/views/components/ui/item/header.blade.php -
resources/views/components/ui/item/footer.blade.php
Use with AI
A brief for your coding agent: install command, usage, props, guidance and the rules. Copy it, or open a prompt about this component in an assistant.
# Brok UI: Item (`item`)
A flexible layout for list rows: media, content (title, description), actions, plus full-width header and footer rows; grouped with separators, as a container, link or button.
Brok UI is a Laravel Blade component registry. Installed components are plain Blade files the app owns.
## Install
```bash
php artisan ui:add item
```
## Usage
```blade
<x-ui.item variant="outline">
<x-ui.item.media variant="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M2 7a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2z" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Project Alpha') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Updated 2 hours ago') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.button variant="outline" size="sm">{{ __('View') }}</x-ui.button>
</x-ui.item.actions>
</x-ui.item>
```
## Props
- `variant` (default|outline|muted|icon|image|icon-sm, default `default`) — Border treatment: default (transparent), outline, or muted (filled background).
- `size` (default|md|sm|xs, default `default`) — Padding and gap tier: default/md, sm, or xs.
- `href` (mixed|null, default `null`) — When set, renders the item as a link and makes it interactive.
- `clickable` (bool, default `false`) — Renders the item as a button and makes it interactive, when href is not set.
- `active` (bool, default `false`) — Marks the item as the current selection, applying accent styling and aria-current or aria-pressed.
- `disabled` (bool, default `false`) — Disables interaction and dims the item; a disabled link also drops out of tab order.
## Use when
- Use to group related content into scannable units for browsing, prioritization, or rearrangement.
- Building a list row that combines media, a title and description, and trailing actions in one consistent layout.
- Grouping several rows with item.group and item.separator, optionally as clickable links or buttons.
## Avoid when
- Do not use card-like structures when dense row-by-row comparison would be clearer in a list or table.
- The row is a simple key-value pair with no media or actions; a plain flex row is lighter weight.
- The rows need multi-column sortable data; use table instead.
## Anti-patterns
- Turning every object into a card
## Rules
- Use the `<brok:item>` tag (or `<x-ui.item>`) in Blade; do not rewrite the component.
- Prefer the documented props and variants over utility-class overrides; when a utility must win, use the `!` important modifier.
- Use semantic design tokens (`bg-primary`, `text-muted-foreground`), never raw colour utilities.
- Keep the `data-slot` attributes; they are the styling and test hooks.
## Links
- Docs: https://brokui.dev/docs/components/item
- Registry JSON (files, props, contract): https://brokui.dev/r/open/item.json
Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.
Examples
Clickable
<x-ui.item href="#" variant="outline">
<x-ui.item.media variant="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z" />
<path d="M12 16v-4" />
<path d="M12 8h.01" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Account settings') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Manage your profile and preferences') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<svg class="size-4 text-muted-foreground rtl:-scale-x-100" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m9 18 6-6-6-6" />
</svg>
</x-ui.item.actions>
</x-ui.item>
<x-ui.item.group class="rounded-md border border-border divide-y divide-border">
<x-ui.item>
<x-ui.item.content>
<x-ui.item.title>{{ __('Two-factor authentication') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Add an extra layer of security to your account') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.badge variant="secondary">{{ __('On') }}</x-ui.badge>
</x-ui.item.actions>
</x-ui.item>
<x-ui.item>
<x-ui.item.content>
<x-ui.item.title>{{ __('Email notifications') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Receive updates about account activity') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.badge variant="outline">{{ __('Off') }}</x-ui.badge>
</x-ui.item.actions>
</x-ui.item>
<x-ui.item>
<x-ui.item.content>
<x-ui.item.title>{{ __('Active sessions') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Manage devices signed in to your account') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.button variant="ghost" size="sm">{{ __('Review') }}</x-ui.button>
</x-ui.item.actions>
</x-ui.item>
</x-ui.item.group>
<div class="flex w-full flex-col gap-2">
<x-ui.item href="#" active="true">
<x-ui.item.media variant="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect width="7" height="9" x="3" y="3" rx="1" />
<rect width="7" height="5" x="14" y="3" rx="1" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Dashboard') }}</x-ui.item.title>
</x-ui.item.content>
</x-ui.item>
<x-ui.item href="#">
<x-ui.item.media variant="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M3 3v18h18" />
<path d="m19 9-5 5-4-4-3 3" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Reports') }}</x-ui.item.title>
</x-ui.item.content>
</x-ui.item>
</div>
<div class="flex w-full flex-col gap-3">
<x-ui.item variant="outline" size="default">
<x-ui.item.media variant="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<path d="M14 2v6h6" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Default size') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Comfortable padding and gap') }}</x-ui.item.description>
</x-ui.item.content>
</x-ui.item>
<x-ui.item variant="outline" size="sm">
<x-ui.item.media variant="icon-sm">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<path d="M14 2v6h6" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Small size') }}</x-ui.item.title>
</x-ui.item.content>
</x-ui.item>
<x-ui.item variant="outline" size="xs">
<x-ui.item.media variant="icon-sm">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<path d="M14 2v6h6" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Extra small') }}</x-ui.item.title>
</x-ui.item.content>
</x-ui.item>
</div>
With Avatar
<x-ui.item variant="outline">
<x-ui.item.media>
<x-ui.avatar src="https://i.pravatar.cc/80?img=47" alt="{{ __('Sarah Chen') }}" fallback="SC" />
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Sarah Chen') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Product Designer') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.button variant="outline" size="sm">{{ __('Follow') }}</x-ui.button>
</x-ui.item.actions>
</x-ui.item>
With Badge
<x-ui.item variant="outline">
<x-ui.item.media variant="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect width="20" height="14" x="2" y="5" rx="2" />
<line x1="2" x2="22" y1="10" y2="10" />
</svg>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>
{{ __('Stripe') }}
<x-ui.badge variant="secondary" size="sm">{{ __('Connected') }}</x-ui.badge>
</x-ui.item.title>
<x-ui.item.description>{{ __('Payments and subscriptions') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.button variant="ghost" size="sm">{{ __('Manage') }}</x-ui.button>
</x-ui.item.actions>
</x-ui.item>
With Header
{{-- `item.header` spans the whole row above the media/content/actions line;
`item.footer` spans it below. Both wrap because the item is a wrapping flex row. --}}
<x-ui.item variant="outline" class="w-full max-w-sm">
<x-ui.item.header class="aspect-[3/1] overflow-hidden rounded-sm bg-gradient-to-br from-muted to-secondary">
<span class="sr-only">{{ __('Cover') }}</span>
</x-ui.item.header>
<x-ui.item.content>
<x-ui.item.title>{{ __('Midnight sessions') }}</x-ui.item.title>
<x-ui.item.description>{{ __('12 tracks, 48 minutes') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.button size="sm">{{ __('Play') }}</x-ui.button>
</x-ui.item.actions>
<x-ui.item.footer class="text-xs text-muted-foreground">
<span>{{ __('Added 3 days ago') }}</span>
<x-ui.badge variant="secondary" size="sm">{{ __('Lossless') }}</x-ui.badge>
</x-ui.item.footer>
</x-ui.item>
With Image
<x-ui.item variant="outline">
<x-ui.item.media variant="image">
<img
src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=160&q=80"
alt="{{ __('Mountain retreat') }}"
class="size-full object-cover"
/>
</x-ui.item.media>
<x-ui.item.content>
<x-ui.item.title>{{ __('Mountain retreat') }}</x-ui.item.title>
<x-ui.item.description>{{ __('Lakeside cabin, 2 nights') }}</x-ui.item.description>
</x-ui.item.content>
<x-ui.item.actions>
<x-ui.badge variant="secondary">{{ __('Available') }}</x-ui.badge>
</x-ui.item.actions>
</x-ui.item>
API
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | default | outline | muted | icon | image | icon-sm | default | Border treatment: default (transparent), outline, or muted (filled background). |
| size | default | md | sm | xs | default | Padding and gap tier: default/md, sm, or xs. |
| href | mixed | null | null | When set, renders the item as a link and makes it interactive. |
| clickable | bool | false | Renders the item as a button and makes it interactive, when href is not set. |
| active | bool | false | Marks the item as the current selection, applying accent styling and aria-current or aria-pressed. |
| disabled | bool | false | Disables interaction and dims the item; a disabled link also drops out of tab order. |
Slots
default— Compositional parts: media, content (title, description), actions, header, and footer.x-ui.item.group— Installed subcomponent from the registry item.x-ui.item.media— Installed subcomponent from the registry item.x-ui.item.content— Installed subcomponent from the registry item.x-ui.item.title— Installed subcomponent from the registry item.x-ui.item.description— Installed subcomponent from the registry item.x-ui.item.actions— Installed subcomponent from the registry item.x-ui.item.separator— Installed subcomponent from the registry item.x-ui.item.header— Installed subcomponent from the registry item.x-ui.item.footer— Installed subcomponent from the registry item.
Data slots
Stable hooks for CSS overrides and browser tests.
Behavior
- The root renders as a div by default, an anchor when href is set, or a button when clickable is set, so keyboard behavior and semantics come from the native element.
- An active link item gets aria-current="true" and an active button item gets aria-pressed="true", reflecting the selection in the accessibility tree.
- A disabled interactive item is removed from tab order (a link gets tabindex="-1"; a button gets the disabled attribute) and marked aria-disabled.
- Declares registry capability flags: a11y, responsive, rtl, darkMode, localized.
Guidance
Organize browsable objects into scannable units.
Use when
- Use to group related content into scannable units for browsing, prioritization, or rearrangement.
- Building a list row that combines media, a title and description, and trailing actions in one consistent layout.
- Grouping several rows with item.group and item.separator, optionally as clickable links or buttons.
Avoid when
- Do not use card-like structures when dense row-by-row comparison would be clearer in a list or table.
- The row is a simple key-value pair with no media or actions; a plain flex row is lighter weight.
- The rows need multi-column sortable data; use table instead.
Use instead
- Table for exact comparison
- List for compact scanning
Anti-patterns
- Turning every object into a card
- Anatomy
- Theming hooks
Accessibility
- Keyboard
- No component-owned keyboard interaction; native element behavior applies.
- Focus
none
- Interactive items (href or clickable) get real link or button semantics rather than a div with a click handler, so they are reachable and operable from the keyboard.
- Selection state is exposed via aria-current or aria-pressed rather than color alone.
- Semantic HTML and a stable
data-slotattribute for styling and scripting hooks. - Focus-visible rings use the
ringtoken, so keyboard focus is always visible. - Disabled and invalid states are conveyed to assistive tech, not by color alone.
- Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces in the preview.
- Labels go through
__()and layout uses logical properties (ms-*,text-start), so it mirrors underdir="rtl"— flip the preview to RTL to confirm. - Dark mode uses the same semantic tokens under the
darkclass; high contrast follows forced-color system tokens.
Livewire
Livewire can update this component through forwarded wire:* attributes.
Source
The exact, editable files ui:add writes
into your app. Previews render this same code; there are no preview-only components.
@props([
'variant' => 'default',
'size' => 'default',
'href' => null,
'clickable' => false,
'active' => false,
'disabled' => false,
])
@php
$styles = require base_path(config('ui.component_path', 'resources/views/components/ui').'/_styles.php');
$variant = $styles['normalizeVariant']($variant);
$variants = [
'default' => 'border-transparent',
'outline' => 'border-border',
'muted' => 'border-transparent bg-muted',
];
$sizes = [
// `md` is the house default-size token; `default` is kept as an alias so
// existing `size="default"` usage stays valid (shared map value).
'md' => 'gap-4 p-4 text-sm',
'default' => 'gap-4 p-4 text-sm',
'sm' => 'gap-3 p-3 text-sm',
'xs' => 'gap-2 px-3 py-2 text-xs',
];
// An item becomes interactive when given an href or marked clickable.
// Links and buttons provide their keyboard behavior and semantics natively.
$isLink = $href !== null;
$isInteractive = $isLink || $clickable;
$tag = $isLink ? 'a' : ($clickable ? 'button' : 'div');
$forwardedAttributes = $tag === 'button' ? $attributes->except(['type']) : $attributes;
$base = 'group/item flex flex-wrap items-center rounded-md border transition-colors motion-reduce:transition-none';
$interactiveClass = $isInteractive
? 'cursor-pointer hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background'
: '';
$activeClass = $active ? 'bg-accent text-accent-foreground' : '';
$disabledClass = $disabled ? 'pointer-events-none opacity-50' : '';
$classes = trim(implode(' ', array_filter([
$base,
$variants[$variant] ?? $variants['default'],
$sizes[$size] ?? $sizes['default'],
$interactiveClass,
$activeClass,
$disabledClass,
])));
@endphp
<{{ $tag }}
data-slot="item"
data-variant="{{ $variant }}"
data-size="{{ $size }}"
@if ($active) data-active="true" @endif
@if ($isLink) href="{{ $disabled ? null : $href }}" @endif
@if ($tag === 'button') type="{{ $attributes->get('type', 'button') }}" @disabled($disabled) @endif
@if ($isLink && $active) aria-current="true" @endif
@if ($tag === 'button') aria-pressed="{{ $active ? 'true' : 'false' }}" @endif
@if ($isInteractive && $disabled) aria-disabled="true" @endif
@if ($isLink && $disabled) tabindex="-1" @endif
{{ $forwardedAttributes->merge(['class' => $classes]) }}
>
{{ $slot }}
</{{ $tag }}>
{{-- No role="list": the slotted <x-ui.item> children are plain containers,
links or buttons, never listitems, so a list role would announce
"list, 0 items" and orphan every child from its container. --}}
<div
data-slot="item-group"
{{ $attributes->merge(['class' => 'flex w-full flex-col']) }}
>
{{ $slot }}
</div>
@props([
'variant' => 'default',
])
@php
$styles = require base_path(config('ui.component_path', 'resources/views/components/ui').'/_styles.php');
$variant = $styles['normalizeVariant']($variant);
$variants = [
'default' => '',
'icon' => 'size-8 rounded-sm bg-muted [&_svg]:size-4',
'image' => 'size-10 overflow-hidden rounded-sm',
// Compact icon tile for sm/xs item rows and dense menus.
'icon-sm' => 'size-6 rounded-sm bg-muted [&_svg]:size-4',
];
$base = 'flex shrink-0 items-center justify-center text-foreground';
$classes = trim($base.' '.($variants[$variant] ?? $variants['default']));
@endphp
<div
data-slot="item-media"
data-variant="{{ $variant }}"
{{ $attributes->merge(['class' => $classes]) }}
>
{{ $slot }}
</div>
<div
data-slot="item-content"
{{ $attributes->merge(['class' => 'flex flex-1 flex-col gap-0.5']) }}
>
{{ $slot }}
</div>
<div
data-slot="item-title"
{{ $attributes->merge(['class' => 'flex items-center gap-2 text-sm font-medium leading-snug text-foreground']) }}
>
{{ $slot }}
</div>
<div
data-slot="item-description"
{{ $attributes->merge(['class' => 'text-sm leading-normal text-muted-foreground']) }}
>
{{ $slot }}
</div>
<div
data-slot="item-actions"
{{ $attributes->merge(['class' => 'flex items-center gap-2']) }}
>
{{ $slot }}
</div>
<div
role="separator"
data-slot="item-separator"
{{ $attributes->merge(['class' => 'h-px w-full bg-border']) }}
></div>
{{-- A full-width row above the media/content/actions line: a cover image, a
chart, or a label bar. Spans the whole item; the row below wraps under it. --}}
<div
data-slot="item-header"
{{ $attributes->merge(['class' => 'flex w-full basis-full items-center justify-between gap-2']) }}
>
{{ $slot }}
</div>
{{-- A full-width row under the content: metadata, a progress bar, a tag row. --}}
<div
data-slot="item-footer"
{{ $attributes->merge(['class' => 'flex w-full basis-full items-center justify-between gap-2']) }}
>
{{ $slot }}
</div>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.5.2 - Status
- Stable
- License
-
open - Accessibility reviewed
- No review date recorded
- Last breaking change
- No date recorded
- Deprecation
- Not deprecated
- Contract
-
v6 - Foundation
-
≥ 1.0.0