--- meta: title: Input description: Inputs collect data from the user. layout: component --- ```html:preview ``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` :::tip This component works with standard `
` elements. Please refer to the section on [form controls](/getting-started/form-controls) to learn more about form submission and client-side validation. ::: ## Examples ### Labels Use the `label` attribute to give the input an accessible label. For labels that contain HTML, use the `label` slot instead. ```html:preview ``` ```jsx:react import SlIcon from '@shoelace-style/shoelace/dist/react/icon'; import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` ### Help Text Add descriptive help text to an input with the `help-text` attribute. For help texts that contain HTML, use the `help-text` slot instead. ```html:preview ``` ```jsx:react import SlIcon from '@shoelace-style/shoelace/dist/react/icon'; import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` ### Placeholders Use the `placeholder` attribute to add a placeholder. ```html:preview ``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` ### Clearable Add the `clearable` attribute to add a clear button when the input has content. ```html:preview ``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` ### Toggle Password Add the `password-toggle` attribute to add a toggle button that will show the password when activated. ```html:preview ``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` ### Filled Inputs Add the `filled` attribute to draw a filled input. ```html:preview ``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` ### Disabled Use the `disabled` attribute to disable an input. ```html:preview ``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ; ``` ### Sizes Use the `size` attribute to change an input's size. ```html:preview

``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ( <>

); ``` ### Pill Use the `pill` attribute to give inputs rounded edges. ```html:preview

``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ( <>

); ``` ### Input Types The `type` attribute controls the type of input the browser renders. ```html:preview

``` ```jsx:react import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ( <>

); ``` ### Prefix & Suffix Icons Use the `prefix` and `suffix` slots to add icons. ```html:preview

``` ```jsx:react import SlIcon from '@shoelace-style/shoelace/dist/react/icon'; import SlInput from '@shoelace-style/shoelace/dist/react/input'; const App = () => ( <>

); ``` ### Customizing Label Position Use [CSS parts](#css-parts) to customize the way form controls are drawn. This example uses CSS grid to position the label to the left of the control, but the possible orientations are nearly endless. The same technique works for inputs, textareas, radio groups, and similar form controls. ```html:preview ```