A simple input component with support for easy labels and placeholders.
---import { Input } from 'studiocms:ui/components/input';---
<Input label='Label' placeholder='Placeholder' />You can set the input’s type to like you would normally. Here’s a password input to show you how that’s done:
---import { Input } from 'studiocms:ui/components/input';---
<Input label='Label' placeholder='Placeholder' type='password' />You can disable the input altogether by using the disabled prop.
---import { Input } from 'studiocms:ui/components/input';---
<Input label='Label' placeholder='Placeholder' disabled />Inputs have full form support. You can use the isRequired and name attributes as needed.
The first one does what it says it does, while the latter sets the name attribute so you can access the input in, for example,
the FormData returned by a submission. Here’s an example showing how to set both of them:
---import { Input } from 'studiocms:ui/components/input';---
<Input label='Label' placeholder='Placeholder' isRequired name='example-input' />You can pass the name of an icon using the icon prop to display it inside of the input on the left side. To show the icon on the
right hand side of the input, or explicitly set the position, pass an object to the icon prop containing the name and position
of the icon:
---import { Input } from 'studiocms:ui/components/input';---
<Input label='Label' placeholder='Placeholder' icon='heroicons:bolt-20-solid' /><Input placeholder='Placeholder' icon={{ name: 'heroicons:bolt-20-solid', position: 'right' }} />You can add a description to be shown below the input by using the description prop:
---import { Input } from 'studiocms:ui/components/input';---
<Input label='Label' placeholder='Placeholder' description='This is some text to help the user understand the input!' />