---
title: Examples
slug: wip/-Auc-examples
createdAt: 2023-07-20T14:45:03.180Z
---

# Examples

## Basic Usage

A label will be displayed when provided via the `label` property.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/VwXJgVW/545cd8de04f74256a447972397180b96?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;185px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Help Text & Placeholder

The help text and placeholder serve the purpose of guiding a user's input by providing additional information.

A help text provides more context as to why and how the data that is requested is relevant whereas a placeholder showcases an example of how data should be entered.

A help text can either be passed as an attribute for simple string-based content or via a slot for rich formatted content.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/rNvaQvE/e1d1ad76fd503fa00a41d8b5c62da1ee?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;328px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Required and Optional

Adding a required or optional label helps users to be guided while filling out a form. Usually, only Inputs that are an exception to the majority of other form fields in a form are marked as required or optional. For example, Inputs are marked as "Required" when the majority of the fields in the same form are optional and vice versa.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed//WNKRayw/f798d9322403313374735847922c2c03?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;342px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Icons

Icons can provide additional clarification on the content that should be entered.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/JjvXRjV/e2e1635af511511e03641c0c7647a10a?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;262px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## States

The Input supports a wide range of different states.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/vYRqbvW/fea0d6f53eec0bc1e341251acd2cd571?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;414px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Clearable

Marking an Input as clearable allows users to empty their value with a single click.

To define an accessible name for the clear button, the `clear-aria-label` can be used. In absence of one, the button will be rendered invisible accessibility-wise.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/xxjJgox/775a9f0568a28ba5f519ea0d13ae1d36?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;219px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Validation

An Input's validity can either be determined automatically when used inside a form or can be controlled from outside based on custom rules and application business logic.

### Inside a form

Inputs seamlessly integrate into a form's validation workflows and validate when a form is submitted. When no custom validation message is provided, the Input falls back to the browser's native validation message.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/gOeNqqz/03b99c4c88c381558e64fe67c73c7671?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;265px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

### Inside an application

Inputs can be individually flagged as invalid based on custom rules or other business logic of an application. When flagged as invalid, an Input expects a descriptive validation message to be set alongside.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/mdjOPLy/b0c8e5f7039d21d4a469c5bc7a537b67?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;265px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Listening to Events

The Input supports the most commonly used events.

:::hint{type="info"}
**💡 Did you know?**

Some native events like `change` are blocked by the Shadow DOM boundary of the web component standard. Hence some of them are proxied through custom events.

Find out more: [Form Input Events & API](https://cosmos.redbull.design/wip/form-input-events-and-api)
:::

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/KKojEzK/ec521500060f47309d3c84b7e72c4b9e?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;454px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Types

There is a wide variety of input types and control widgets available, depending on the device and user agent. 

When not specified, the Input defaults to a `type` of "text".

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/QWryMwQ/c2acd091cf72539a1ca752ad0d61120f?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;877px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

