Skip to main content

Components

Textfield

Textfield allows users to enter free text or numbers.

Usage

Examples

With rows

With prefix and suffix

With counter

HTML

This is a composite component, which uses Field, Input or Textarea and Label under the hood.

Since this component is built from multiple components, we recommend reading the documentation for the underlying components to get a full overview of the HTML structure.

CSS variables and data attributes

Textfield is a composite component, with Field, Input or Textarea and Label.

Here we only show ds-input's variables and data attributes.

CSS Variables
NameValue
--dsc-input-paddingvar(--ds-size-2) var(--ds-size-3)
--dsc-input-size--togglevar(--ds-size-6)
--dsc-input-sizevar(--ds-size-12)
--dsc-input-background--readonlyvar(--ds-color-neutral-surface-tinted)
--dsc-input-backgroundvar(--ds-color-neutral-surface-default)
--dsc-input-border-color--readonlyvar(--ds-color-neutral-border-subtle)
--dsc-input-border-colorvar(--ds-color-neutral-border-default)
--dsc-input-border-stylesolid
--dsc-input-border-width--togglemax(var(--ds-border-width-default),calc(var(--ds-size-1)/2))
--dsc-input-border-widthvar(--ds-border-width-default)
--dsc-input-outline-color--hovervar(--ds-color-neutral-border-default)
--dsc-input-outline-color--toggle--hovervar(--dsc-input-accent-color)
--dsc-input-outline-width--hovervar(--ds-border-width-default)
--dsc-input-outline-style--hoversolid
--dsc-input-color--readonlyvar(--ds-color-neutral-text-default)
--dsc-input-colorvar(--ds-color-neutral-text-default)
--dsc-input-stroke-colorvar(--ds-color-base-contrast-default)
--dsc-input-stroke-color--invalidvar(--ds-color-danger-base-contrast-default)
--dsc-input-stroke-width0.05em
--dsc-input-accent-colorvar(--ds-color-base-default)
--dsc-input-accent-color--invalidvar(--ds-color-danger-text-subtle)
Data Attributes
NameValue
data-widthauto
Edit this page on github.com (opens in a new tab)