Soracom

Design System

Input

This component was previously named ds-text-input.

Options

There are two basic html structures for using ds-input. The most basic implementation is to apply ds-input directly to the html input/textarea element.

As of v1.13 ds-input can be applied to a wrapper div which provides better icon support and improved layout when combined with ds-text --addon.

ds-input may be used with html input or html textarea (available from v1.8.12+) elements.

Basic usage

Div element

html
Copy

Input element

html
Copy

Textarea element

html
Copy

Component state

Disabled

Div element disabled state

html
Copy

Input element disabled state

html
Copy

Textarea element disabled state

html
Copy

Readonly

Div element readonly state

html
Copy

Input element readonly state

html
Copy

Textarea element readonly state

html
Copy

Placeholder

Div element

html
Copy

Input element with placeholder text

html
Copy

Textarea element with placeholder text

html
Copy

Visual states

Text input adheres to the 4x preset visual states - alert, warning, success and info.

Div element with visual state

html
Copy

Input element with visual state

html
Copy

Textarea element with visual state

html
Copy

Icons

To apply icons to ds-input, you must use the div based html structure.

Input with icon

html
Copy

Textarea with icon

html
Copy

Size

Small, large

Small size

html
Copy

Large size

html
Copy

Narrow, mid, wide

By default ds-input takes the full width of it’s container element.

Narrow size

html
Copy

Mid size

html
Copy

Wide size

html
Copy

Types

Date picker

The native date picker works across all target browsers and the UI is specific to each to browser.

The displayed date is formatted based on the locale of the user’s browser, but the parsed value is always formatted yyyy-mm-dd

Optional attributes

Attribute Required Description Value
max Optional The latest allowable date yyyy-mm-dd
min Optional The earliest allowable date yyyy-mm-dd
step Optional The step increment when adjusting the date “any” or number
html
Copy

Time picker

The native time picker works across all target browsers and the UI is specific to each to browser.

The displayed time is formatted based on the locale of the user’s browser, but the parsed value is always in 24-hour format that includes leading zeros: hh:mm or hh:mm:ss.

The time picker is only for specific time values (00:00 - 24:00). Longer times (for specifying time length such as 48 hours) will not work with the native type="time" component.

Optional attributes

Attribute Required Description Value
max Optional The latest allowable time hh:mm or hh:mm:ss
min Optional The earliest allowable time hh:mm or hh:mm:ss
step Optional The step increment when adjusting the time “any” or number
html
Copy

Datetime picker

The native datetime picker works across all target browsers except Firefox and the UI is specific to each to browser.

See also the split datetime picker - which is also works in Firefox.

The displayed date is formatted based on the locale of the user’s browser, but the parsed value is always formatted yyyy-mm-ddThh:mm

Optional attributes

Attribute Required Description Value
max Optional The latest allowable date yyyy-mm-ddThh:mm
min Optional The earliest allowable date yyyy-mm-ddThh:mm
step Optional The step increment when adjusting the date “any” or number
pattern Optional Only used by browsers that don’t support datetime-local “[0-9]4-[0-9]2-[0-9]2T[0-9]2:[0-9]2”
placeholder Optional Only used by browsers that don’t support datetime-local “yy-mm-ddThh:mm”
html
Copy

Split datetime

Split datetime uses two input fields - type="date", type="time" (See the requirements/options for each above) and optional ds-button.

This version has the advantage of working across all target browsers (including Firefox).

html
Copy

File upload

See Field with file upload for additional examples.

Basic file upload input

html
Copy

Styles

Code style

Use mono-space Source Sans Code font

html
Copy

Composition

Child components

The wrapper form of ds-input supports SDS components as direct children before or after the native input element.

Buttons

ds-button can be used as a child of ds-input. See ds-button for further examples.

Text

ds-text can be used as a child of ds-input. See ds-text for further examples.

Plain text

html
Copy

Addon text

html
Copy

Light addon text

html
Copy

Dark addon text

html
Copy

Inline icons

html
Copy

Tags

html
Copy

Multiple child components

html
Copy

Examples

datetime-split combined with sizing options

html
Copy

datetime-split with buttons combined with sizing options

html
Copy

datetime-split with ds-autoselect combined with sizing options

html
Copy

datetime-split with buttons and ds-autoselect combined with sizing options

html
Copy

Manifest

The component manifest describes this component's API: its modifiers, structure, data attributes, CSS custom properties, accessibility notes, and example markup. It is consumed by tooling such as AI assistants and code generators.

Latest version: https://assets.soracom.io/sds/3.40.1/ds-input/manifest.json?v=3.40.1

manifest.json
Copy