Files
ui/docs/content/3.forms/1.input.md
2023-05-26 22:07:49 +02:00

152 lines
2.3 KiB
Markdown

---
github: true
description: Display an input field.
---
## Usage
::component-card
---
baseProps:
name: 'input'
---
::
### Style
Use the `color` and `variant` props to change the visual style of the Input.
::component-card
---
baseProps:
name: 'input'
placeholder: 'Search...'
props:
color: 'primary'
variant: 'outline'
---
::
Besides all the colors from the `ui.colors` object, you can also use the `white` (default) and `gray` colors with their pre-defined variants.
#### White
::component-card
---
baseProps:
name: 'input'
placeholder: 'Search...'
props:
color: 'white'
variant: 'outline'
excludedProps:
- color
---
::
#### Gray
::component-card
---
baseProps:
name: 'input'
placeholder: 'Search...'
props:
color: 'gray'
variant: 'outline'
excludedProps:
- color
---
::
### Size
Use the `size` prop to change the size of the Input.
::component-card
---
baseProps:
name: 'input'
props:
size: 'sm'
---
::
### Placeholder
Use the `placeholder` prop to set a placeholder text.
::component-card
---
baseProps:
name: 'input'
props:
placeholder: 'Search...'
---
::
### Icon
Use any icon from [Iconify](https://icones.js.org) by setting the `icon` prop by using this pattern: `i-{collection_name}-{icon_name}`.
Use the `leading` and `trailing` props to set the icon position or the `leading-icon` and `trailing-icon` props to set a different icon for each position.
::component-card
---
baseProps:
name: 'input'
placeholder: 'Search...'
props:
icon: 'i-heroicons-magnifying-glass-20-solid'
size: 'sm'
color: 'white'
trailing: false
extraColors:
- white
- gray
excludedProps:
- icon
---
::
### Disabled
Use the `disabled` prop to disable the Input.
::component-card
---
baseProps:
name: 'input'
placeholder: 'Search...'
props:
disabled: true
---
::
### Loading
Use the `loading` prop to show a loading icon and disable the Input.
Use the `loading-icon` prop to set a different icon or change it globally in `ui.input.default.loadingIcon`. Defaults to `i-heroicons-arrow-path-20-solid`.
::component-card
---
baseProps:
name: 'input'
placeholder: 'Searching...'
props:
loading: true
icon: 'i-heroicons-magnifying-glass-20-solid'
excludedProps:
- icon
---
::
## Props
:component-props
## Preset
:component-preset