Showcase

Blazor Input Group

The Blazor Bootstrap InputGroup component extends form inputs with text, icon, checkbox, radio, button, and dropdown add-ons on either side. The examples below cover sizing, checkboxes and radios, multiple inputs, multiple add-ons and button add-ons.
API Documentation
INFO
InputGroup follows the Bootstrap 5.3 input group. It wraps TextInput, NumberInput, CurrencyInput, DateInput, TimeInput, TextAreaInput, EnumInput, and Blazor's InputFile. PasswordInput and AutoComplete already render their own input group, so they cannot be placed inside an InputGroup.

Basic usage #

Place text or icon add-ons before, after, or on both sides of an input.
How to use:
  1. Add InputGroup and put the input and its InputGroupText add-ons inside, in display order.
  2. Give the input an accessible name with aria-label or a <label> outside the group.
  3. Set an Id on the InputGroupText and reference it from the input's aria-describedby so screen readers read the add-on with the input.
  4. Keep help text outside the group.
This demo shows prefix, suffix, label-plus-help, icon, and textarea groups.

Sizing #

Set the size on the group, and every input and add-on inside it resizes.
How to use:
  1. Set Size to InputGroupSize.Small or InputGroupSize.Large.
  2. Do not size the individual inputs inside the group.
This demo shows small, default, and large groups, and small and large groups with a Dropdown add-on.

Checkboxes and radios #

Put a checkbox or radio inside an add-on instead of text.
How to use:
  1. Place an <input class="form-check-input mt-0"> of type checkbox or radio inside InputGroupText.
  2. Give the checkbox or radio an aria-label, because it has no visible label.
  3. Give radios in the same set the same name.
This demo enables an email field with a checkbox and picks a contact method with radios.

Multiple inputs #

A group can hold more than one input. Validation styling is supported only for groups with a single input, as in Bootstrap.
How to use:
  1. Place the inputs side by side inside InputGroup.
  2. Give each input its own aria-label.
This demo collects a first and last name.

Multiple add-ons #

Stack several add-ons on one side, or use add-ons on both sides.
How to use:
  1. Add several InputGroupText components next to each other.
  2. Mix them freely with the input.
This demo shows currency and unit add-ons around a NumberInput.

Button add-ons #

Use Button components as add-ons, one or more on each side.
How to use:
  1. Place Button components before or after the input inside InputGroup.
  2. Give icon-only or symbol-only buttons an aria-label.
This demo shows a paste button, a search button, and a seat counter with buttons on both sides.

Buttons with dropdowns #

Use a Dropdown as an add-on to let users choose an option that changes the input.
How to use:
  1. Place a Dropdown with a DropdownToggleButton and DropdownMenu before or after the input.
  2. Set Position="DropdownMenuPosition.End" on the menu when the dropdown is the last add-on.
This demo picks a search field and a currency.

Segmented buttons #

Combine an action button with a split dropdown toggle.
How to use:
  1. Place a Dropdown with Split="true", a DropdownActionButton, and a DropdownToggleButton next to the input.
  2. Give the split toggle screen-reader text with a visually-hidden span, because it has no visible text.
This demo sends, schedules, or saves a message.

Select and file inputs #

Select menus and file inputs work in input groups too.
How to use:
  1. Use EnumInput for a select, or Blazor's InputFile with class="form-control" for a file input.
  2. To label the control with the add-on, set For on InputGroupText to the control's id; the add-on then renders as a <label>.
This demo labels a select and a file input with add-ons and pairs a select with a button.

Wrapping #

Input groups wrap by default so validation messages fit. Turn wrapping off to keep everything on one line.
How to use:
  1. Set NoWrap="true".
This demo shows both behaviors in a narrow container.

EditForm validation #

A group with a single input shows its validation message below the group, with the corners intact.
How to use:
  1. Place the input inside InputGroup in an EditForm.
  2. Add ValidationMessage as the last child of the InputGroup.
This demo requires a username and a budget before the form can be submitted.

Supported inputs #

The Blazor Bootstrap inputs that render a single input element work inside an input group.
How to use:
  1. Use TextInput, NumberInput, CurrencyInput, DateInput, TimeInput, TextAreaInput, or EnumInput inside InputGroup.
  2. Do not nest PasswordInput or AutoComplete; they already render their own input group.
This demo shows currency, date, and time inputs with add-ons.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.