Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/input

TextInput

Campo de texto con etiqueta flotante, error, ayuda, íconos a los costados y tres tamaños.

367 sitios de import en 9 de 15 verticales — un archivo que la importa cuenta una vez, monte una instancia o veinte.

  • TheCharterPanel
  • carlosmartinpavon
  • cmp-packages
  • dietaly
  • elliot
  • gestorsalon
  • luigi
  • raquetea
  • zentrya

El componente, montado

Cargando el espécimen…

Cómo se usa

import { TextInput } from '@solu30/ui-kit/input'

Props

13 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
labelopcionalstringFloating label text
erroropcionalstringError message to display below input
errorTypeopcional'warning' | 'error'Type of error styling: 'error' (red) or 'warning' (yellow)
sizeopcionalInputSizeInput size variant
iconopcionalReact.ReactNodeIcon displayed on the left (alias for startIcon)
startIconopcionalReact.ReactNodeIcon displayed on the left
endIconopcionalReact.ReactNodeIcon displayed on the right
prefixopcionalReact.ReactNodeElement rendered inside the input on the left — for text/symbol prefixes (e.g. "$"). Adds pl-9 padding.
suffixopcionalReact.ReactNodeElement rendered inside the input on the right — for text/symbol suffixes (e.g. "kg"). Adds pr-9 padding.
onChangeNumberopcional(value: number) => voidFires alongside onChange with the parsed float value of the input. Returns 0 when value is not a valid number.
helpTextopcionalstringHelp text displayed below input
fullWidthopcionalbooleanWhether input takes full width
floatingLabelopcionalbooleanEnable floating label pattern (CSS-only, no JS state)

Ejemplo del paquete

// El de formulario: trae etiqueta, error y texto de ayuda propios.
// El mensaje de `error` queda enlazado al input, así que no hace falta un <Field> alrededor.
<TextInput
  label="Nombre del salón"
  value={nombre}
  onChange={(e) => setNombre(e.target.value)}
  error={errores.nombre}
  helpText="Es el que ve el cliente."
/>

Del @example del JSDoc de @solu30/ui-kit, sin editar: son 65 de los 541 símbolos. La sangría y los renglones en blanco son los del paquete.