Skip to content
Bladewell
Components
Accordion
Alert
Breadcrumbs
Button
Calendar
Chat
Clock
Command palette
Dropdown
Captcha
Checkbox
Colour picker
Date picker
Date range picker
File upload
Filter builder
Image cropper
Number
OTP
Password
Phone
Radio
Repeater
Search
Select
Show if
Slider
Sortable list
Switch
Tags input
Text input
Textarea
Time picker
Verification code
Field
Icon
Kanban
Auth layout
Sidebar layout
Modal
Pagination
Popover
Price roll
Progress
Stepper
Table
Tabs
Toast
Tooltip
Tooltip cursor
Tree
Docs
Installation
Why Bladewell
For AI agents
Guides
Build a Laravel form from your validation rules
Add a date range picker to a Laravel form
Laravel data table with sorting, filters, pagination
Editable table cells in Laravel with Livewire
A Livewire modal that stays open through re-renders
Using Blade components in Livewire 3 and 4
Two-factor authentication screens for Laravel Fortify
Passkey sign-in for Laravel with Fortify
Real-time notification bell with Laravel Reverb
AI agent actions with Approve and Deny in Laravel
Laravel AI chat with Livewire and streaming replies
Livewire multi-step form with validation per step
Toast notifications in Laravel and Livewire
Livewire file upload with progress and drag and drop
Laravel searchable select that loads from the database
Laravel Blade card, avatar and empty state patterns
Add charts and a rich text editor to a Laravel app
Compare
Bladewell vs Flux: a Free Alternative for Laravel
Bladewell vs Mary UI: daisyUI or Plain Blade
Bladewell vs WireUI: With or Without Alpine
Blade UI Kit Alternative for Laravel 12 and 13
Bladewell vs BladewindUI: Laravel Blade Components
Bladewell vs Sheaf UI: With or Without Alpine
Bladewell vs April UI: Package or Copied-in Code

<x-widget.tags>

Tags input Blade component for Laravel and Livewire

Free-text tags in a field: Enter or a comma adds what's typed, a pasted list adds each item, Backspace removes the last, and each tag has its own remove button. Suggestions from the browser's own list, no duplicates in any case, an optional maximum, and a screen reader hears every change. Submits as name[] and works with Livewire wire:model.

php artisan bladewell:add tags
Also adds
Icon
Works with
Laravel 12 and 13, Livewire 3 and 4, Tailwind CSS 4.1+, PHP 8.3+

Usage

Livewire

In a Livewire component, bind with wire:model (deferred) or wire:model.live to an array property: public array $labels = []. No name is needed. With .live each tag added or removed reaches the server at once. The field shows the property after every render, so setting it in PHP shows the new tags, and its validation errors show under the field.

Blade
<x-widget.tags label="Labels" wire:model.live="labels" :suggestions="['urgent', 'billing', 'refund']" />

On the server

The tags input can't stop a request that skips it. Here's what to check on your server, and what to keep cheap.

Security

  • max and the suggestions only act in the browser: a request can send any number of tags, of any length. Cap both in your Form Request (max: on the array, and on each with tags.*), and drop duplicates in any case.

    OWASP: Input validation · Laravel: Validation

Server cost

  • If each new tag becomes a row, typos and one-offs pile up and every tag list grows. Consider limiting tags to an allowlist (Rule::in() or exists:) where the set is known, or tidying unused tags with a scheduled job.

    Laravel: The in rule · Laravel: Task scheduling

Examples

Basic

Type and press Enter or a comma; paste "red, green, blue" to add all three at once. Backspace in the empty box removes the last tag. The tags submit as name[] (here labels[]), so validate them as an array: 'labels' => ['array', 'max:5'], 'labels.*' => ['string', 'max:30'].

  • urgent
  • billing
Show code
Blade
<x-widget.tags name="labels" label="Labels" :value="['urgent', 'billing']" class="max-w-md" />

Suggestions

suggestions lists tags the browser offers as people type; any other text can still be added. max caps how many: past it, typing more is refused and a screen reader hears why.

Up to five.

Show code
Blade
<x-widget.tags name="skills" label="Skills" placeholder="Add a skill" :suggestions="['Laravel', 'Livewire', 'Tailwind CSS', 'PHP', 'JavaScript', 'MySQL', 'Redis']" :max="5" info="Up to five." class="max-w-md" />

Tags under the box

layout="below" keeps the box to one line and lists the tags under it as cards, for a long list. Everything else works as in the box: Enter, a comma or a pasted list adds, each tag's × removes it, and they submit as name[].

  • Laravel
  • Livewire
  • Blade
  • Tailwind CSS
  • Accessibility
  • Testing
  • Deployment
Show code
Blade
<x-widget.tags name="topics" label="Topics" layout="below" placeholder="Add topics, separated by commas" :value="['Laravel', 'Livewire', 'Blade', 'Tailwind CSS', 'Accessibility', 'Testing', 'Deployment']" class="max-w-md" />

Props

Other attributes, such as autocomplete or data-*, are passed through to the element. class styles the component's outer wrapper.

<x-widget.tags>

Prop Default Description
name null What the tags submit as (name[]); their error and old input are found under it. Optional with wire:model, which then names it.
id null Defaults to one made from the name (or the wire:model property).
label null Shown above the field, and its name for screen readers.
value null The tags to start with. Old input wins after a failed submit; with wire:model and no value, the bound property.
placeholder 'Add a tag' Shown in the box while there are no tags and nothing is typed.
suggestions [] Tags to suggest as people type (the browser's own list). Any other text can still be added.
max null How many tags it takes at most. Past that, typing more is refused and said so.
error null An error message of your own; otherwise the validation error for the name, from the session or Livewire.
info null A hint under the field.
required-message 'Add at least one tag.' Said, in the field's own error style, when a required tags field is submitted empty.
bag 'default' Which error bag to read the error from.
disabled false Greyed out: it can't be changed.
readonly false Shown, and submitted, but it can't be changed: no typing, and no remove buttons. With disabled, disabled wins.
layout 'inline' Where the tags show: inline, in the box before the text; or below, as cards under a one-line box, for a long list.

Accessibility

All 3 examples above are checked with axe-core against the WCAG 2.2 A and AA rules, in the light theme and the dark one, both as the page draws and with each popover, dialog, toast and tooltip opened, on every change. A change that fails can't be merged. Where axe can't decide, such as contrast on SVG text, the test measures the colours itself instead of letting it pass.

Automated checks can't judge everything: how it sounds in a screen reader, and how it feels to use from the keyboard, still need a person. Check those on your own pages too.

Source

What bladewell:add tags writes to your app with the default namespaces. Prefer to copy by hand? Take these files, plus the ones from the components it also adds and Field, and the theme and base CSS.

resources/views/components/widget/tags/index.blade.php Show
index.blade.php
resources/js/widget/tags/index.js Show
index.js
app/View/Widget/ElementIds.php Show
ElementIds.php
app/View/Widget/FormField.php Show
FormField.php