# Text-Input.

## Overview

### What does the component do?

- It is used for the entry of text and numbers.

### When should the component be used?

- When an entry from the user is required.

### Rules

- Optional entries include the text ‘(optional)’ behind the label text. For short fields, the text ‘(optional)’ can be abbreviated to ‘(opt.)’.
- If the text becomes longer than the width of the entry field when being entered, the written text is moved to the left so that what is currently being written can always be seen.
- After leaving the entry field with a long text, it is cut off at the end and designated with “…”.
- If the user can never edit a form field, no entry field may be used (display as text).
- The right type of keyboard must be selected depending on the type of entry field (default, e-mail, URL, phone)

## Variants

### States

The component has the following states:

- Default
- Active
- Error
- Disabled

### Variants

The component has the following variants:

- listed / boxed
- with icon / without icon
- with label / without label

#### Listed, with label, without icons

##### Default

![Image of a text input, with label, without icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-listed-default-light.webp "Text input, with label, without icons, default")

![Image of a text input, with label, without icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-listed-default-dark.webp "Text input, with label, without icons, default")

##### Placeholder

![Image of a text input, with label, without icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-placeholder-light.webp "Text input, with label, without icons, placeholder")

![Image of a text input, with label, without icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-placeholder-dark.webp "Text input, with label, without icons, placeholder")

#### Listed, with label, with icons

##### Default

![Image of a text input, with label, with icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-default-light.webp "Text input, with label, with icons, default")

![Image of a text input, with label, with icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-default-dark.webp "Text input, with label, with icons, default")

##### Placeholder

![Image of a text input, with label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-placeholder-light.webp "Text input, with label, with icons, placeholder")

![Image of a text input, with label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-placeholder-dark.webp "Text input, with label, with icons, placeholder")

#### Listed, without label, with icons

##### Default

![Image of a text input, without label, with icons, default ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-without-label-light.webp "Text input, without label, with icons, default")

![Image of a text input, without label, with icons, default ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-without-label-dark.webp "Text input, without label, with icons, default")

##### Placeholder

![Image of a text input, without label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-without-label-placeholder-light.webp "Text input, without label, with icons, placeholder")

![Image of a text input, without label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-listed-icons-without-label-placeholder-dark.webp "Text input, without label, with icons, placeholder")

#### Boxed, with label, without icons

##### Default

![Image of a boxed text input, with label, without icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-default-light.webp "Boxed text input, with label, without icons, default")

![Image of a boxed text input, with label, without icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-default-dark.webp "Boxed text input, with label, without icons, default")

##### Placeholder

![Image of a boxed text input, with label, without icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-placeholder-light.webp "Boxed text input, with label, without icons, placeholder")

![Image of a boxed text input, with label, without icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-placeholder-dark.webp "Boxed text input, with label, without icons, placeholder")

#### Boxed, with label, with icons

##### Default

![Image of a boxed text input, with label, with icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-default-light.webp "Boxed text input, with label, with icons, default")

![Image of a boxed text input, with label, with icons, default](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-default-dark.webp "Boxed text input, with label, with icons, default")

##### Placeholder

![Image of a boxed text input, with label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-placeholder-light.webp "Boxed text input, with label, with icons, placeholder")

![Image of a boxed text input, with label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-placeholder-dark.webp "Boxed text input, with label, with icons, placeholder")

#### Boxed, without label, with icons

##### Default

![Image of a boxed text input, without label, with icons, default ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-without-label-light.webp "Boxed text input, without label, with icons, default")

![Image of a boxed text input, without label, with icons, default ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-without-label-dark.webp "Boxed text input, without label, with icons, default")

##### Placeholder

![Image of a boxed text input, without label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-without-label-placeholder-light.webp "Boxed text input, without label, with icons, placeholder")

![Image of a boxed text input, without label, with icons, placeholder ](https://digital.sbb.ch/assets/images/mobile/text-input-boxed-icons-without-label-placeholder-dark.webp "Boxed text input, without label, with icons, placeholder")

### Specification

[Design](https://www.figma.com/design/ZBotr4yqcEKqqVEJTQfSUa/Design-System-Mobile?node-id=309-2236&t=N7M8b5Y9aIJc4LzY-1)

---

Source: https://digital.sbb.ch/en/design-system/mobile/components/text-input/
