Skip to content
Twentyfirst UIPro

Input Group

Forms · InputGroup, Icon, Button

View as Markdown

A text field with affixes inside one outline: a protocol before a domain, a currency or unit, a fixed email domain, a search icon, a unit select or a copy button.

  • start and end take text, an Icon or a control. Text affixes are read with the field (aria-describedby); controls keep their own names and are reached with Tab.
  • Takes the props of TextField (label, hint, error, value, onChange, inputMode …). children replaces the built-in input with your own control (give it className="tf-input").
  • The outline shows hover, focus and errors for the whole group; on touch screens the text is 16px so iOS does not zoom.
https://
Without www
@acme.com
€per month

Props

InputGroup

PropTypeNotes
start?ReactNodeBefore the input: text ("https://", "€") is read with the field; an `Icon`, a `Select` or a `Button` sits in the group as it is.
end?ReactNodeAfter the input: text ("@acme.com", "kg"), an icon or a control (copy, unit select …).
children?ReactNodeYour own control instead of the built-in input (it should carry `className="tf-input"`).
label?string
hint?string
error?string

Icon

PropTypeNotes
nameIconNameRequired
size?number
label?string
className?string
style?CSSPropertiesInline style on the root element.

Button

PropTypeNotes
variant?"primary" | "secondary" | "soft" | "ghost" | "danger" | "danger-solid"
size?"md" | "sm"
icon?IconName
iconRight?IconName
disabled?boolean
type?"button" | "submit" | "reset"
onClick?(e: MouseEvent<HTMLButtonElement>) => void
children?ReactNode
asChild?booleanRender the single child element (a link, a router Link) with the button's look instead of a <button>.
id?string
name?stringForm field name and value, sent with the form when this button submits it.
value?string
form?stringThe id of the form this button belongs to, when it sits outside it.
title?string
tabIndex?number
autoFocus?boolean
aria-label?string
aria-labelledby?string
aria-describedby?string
aria-expanded?boolean | "true" | "false"For disclosure and menu triggers: whether what the button controls is open.
aria-controls?string
aria-haspopup?boolean | "true" | "false" | "menu" | "listbox" | "tree" | "grid" | "dialog"
aria-pressed?boolean | "true" | "false" | "mixed"For toggle buttons.
aria-current?boolean | "true" | "false" | "page" | "step" | "location" | "date" | "time"
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.