Text Input

One line of typed text, in a box that owns its own edge.

import { TextInput } from "@dede-style/ui/text-input", then <TextInput value={v} onChange={setV} />. It is controlled, and onChange hands over the string rather than the event, so the DOM stays out of every call site. Put it in a Field to give it a name.

PropDescriptionDefaultControl
valuethe text. Controlled: pass it with onChange
typewhat is being typed: text, email, password, tel, url, search or number. Sets the keyboard and browser behaviourtextemailpasswordtelurlsearchnumbertext
  • text
  • email
  • password
  • tel
  • url
  • search
  • number
variantframe (default) draws the box; plain has no box, for a search in a toolbar. Give a plain field an icon or placeholderframeplainframe
sizeheight: 32, 40 (default) or 48px, matching Button8101210
  • 8
  • 10
  • 12
widthhow many characters the box fits, as a hint of the expected length. full fills the container23451020fullfull
  • 2
  • 3
  • 4
  • 5
  • 10
  • 20
  • full
placeholderan example of the format, shown until something is typed. Not a label
prefixtext at the start of the box, such as a currency sign
prefixIconan icon at the start of the box. In code, import it by its full name: icon plus this (Search is iconSearch)noneAlertAlertFillArrowDownArrowLeftArrowRightArrowUpBag+91 morenone
  • none
  • Alert
  • AlertFill
  • ArrowDown
  • ArrowLeft
  • ArrowRight
  • ArrowUp
  • Bag
  • Bell
  • BellRing
  • BellSlash
  • Bluetooth
  • Bookmark
  • BookmarkFill
  • Calendar
  • Camera
  • Cart
  • Check
  • CheckBold
  • Checkbox
  • CheckboxChecked
  • CheckboxMixed
  • ChevronDown
  • ChevronLeft
  • ChevronRight
  • ChevronUp
  • ChevronsDownUp
  • ChevronsLeft
  • ChevronsRight
  • ChevronsUpDown
  • Clock
  • Close
  • Code
  • CodeAlt
  • Cookie
  • Copy
  • CreditCard
  • DataChart
  • DataColumns
  • DataGrid
  • DataRows
  • Delete
  • Download
  • DragHandle
  • Edit
  • Email
  • Error
  • ErrorFill
  • ExternalLink
  • Eye
  • EyeSlash
  • File
  • Filter
  • Folder
  • Github
  • Heart
  • HeartFill
  • Help
  • HelpFill
  • Home
  • Image
  • Info
  • InfoFill
  • Link
  • Lock
  • LockOpen
  • LogOut
  • Menu
  • Minus
  • MinusBold
  • Moon
  • MoreHorizontal
  • MoreVertical
  • Pause
  • Placeholder
  • Play
  • Plus
  • Radio
  • RadioChecked
  • Refresh
  • Search
  • Settings
  • Share
  • Shield
  • Star
  • StarFill
  • Stop
  • Success
  • SuccessFill
  • Sun
  • SwapVertical
  • Tag
  • TagFill
  • Upload
  • User
  • Warning
  • WarningFill
  • Wifi
  • WifiSlash
suffixtext at the end of the box, such as a unit
suffixIconan icon at the end of the boxnoneAlertAlertFillArrowDownArrowLeftArrowRightArrowUpBag+91 morenone
  • none
  • Alert
  • AlertFill
  • ArrowDown
  • ArrowLeft
  • ArrowRight
  • ArrowUp
  • Bag
  • Bell
  • BellRing
  • BellSlash
  • Bluetooth
  • Bookmark
  • BookmarkFill
  • Calendar
  • Camera
  • Cart
  • Check
  • CheckBold
  • Checkbox
  • CheckboxChecked
  • CheckboxMixed
  • ChevronDown
  • ChevronLeft
  • ChevronRight
  • ChevronUp
  • ChevronsDownUp
  • ChevronsLeft
  • ChevronsRight
  • ChevronsUpDown
  • Clock
  • Close
  • Code
  • CodeAlt
  • Cookie
  • Copy
  • CreditCard
  • DataChart
  • DataColumns
  • DataGrid
  • DataRows
  • Delete
  • Download
  • DragHandle
  • Edit
  • Email
  • Error
  • ErrorFill
  • ExternalLink
  • Eye
  • EyeSlash
  • File
  • Filter
  • Folder
  • Github
  • Heart
  • HeartFill
  • Help
  • HelpFill
  • Home
  • Image
  • Info
  • InfoFill
  • Link
  • Lock
  • LockOpen
  • LogOut
  • Menu
  • Minus
  • MinusBold
  • Moon
  • MoreHorizontal
  • MoreVertical
  • Pause
  • Placeholder
  • Play
  • Plus
  • Radio
  • RadioChecked
  • Refresh
  • Search
  • Settings
  • Share
  • Shield
  • Star
  • StarFill
  • Stop
  • Success
  • SuccessFill
  • Sun
  • SwapVertical
  • Tag
  • TagFill
  • Upload
  • User
  • Warning
  • WarningFill
  • Wifi
  • WifiSlash
requiredrequires a value before the form submits. No asterisk is shown; mark optional fields in their labelfalse
disableddisables the field and dims it. Prefer readOnly when the value should still be read or copiedfalse
readOnlythe value can be read, selected and copied, and is submitted, but not editedfalse
maxLengththe most characters allowed

Tokens

What a theme can move, where the props above are what an instance can move.

TokenDescriptionValue
--text-input-radiusthe corner. No suffix, like --card-radius and unlike --button-radius-rounded, because there is no shape prop carving out one case of three — this is the radius of text inputs. It resolves to --radius-4 by default, the same step Button's rounded shape and Card both take, so a field and the button beside it agree unless a theme deliberately separates them--radius-4

A token appears here only when the value is not already reachable. Anything that resolves through a foundation token or a role needs none, because overriding that already moves it — and a second dial wired to the same value would let this one component drift from everything sharing the role. What is left is the values with no other lever at all.

These are public and overridable — there is no private custom property, because anything on :root is reachable by any stylesheet. What replaces privacy is a stability contract: primitives may move, roles are the guarantee, and these are the per-component escape from both.