Docs
Components
Text Input

Text Input

A component to get user input inside a text field.

Anatomy

Mount all pieces together and create your input

import { TextInput } from '@micode-ui/react';
 
<TextInput.Root>
  <TextInput.LeftIcon>{/* Your Icon */}</TextInput.LeftIcon>
  <TextInput.Input placeholder='Type some text...' />
  <TextInput.RightIcon
    activeIcon={/* Icon when text is visible */}
    inactiveIcon={/* Icon when text not visible */}
  />
</TextInput.Root>;

Example

<Box
  css={{
    display: 'flex',
    flexDirection: 'column',
    background: 'transparent',
    gap: '$2'
  }}
>
  <TextInput.Root>
    <TextInput.LeftIcon>
      <User weight='bold' />
    </TextInput.LeftIcon>
    <TextInput.Input placeholder='Type your username...' />
  </TextInput.Root>
  <TextInput.Root>
    <TextInput.LeftIcon>
      <Envelope weight='bold' />
    </TextInput.LeftIcon>
    <TextInput.Input placeholder='Type your password...' type='password' />
    <TextInput.RightIcon
      activeIcon={<Eye weight='bold' />}
      inactiveIcon={<EyeSlash weight='bold' />}
    />
  </TextInput.Root>
</Box>

API Reference

Root

Contains all parts of the TextInput.

Prop

Type

Default

childrenReactNodeNo default value
errorbooleanfalse
disabledbooleanfalse

LeftIcon

A feedback icon that sits on the left side of the input field.

Prop

Type

Default

childrenReactNodeNo default value

Prefix

A prefix text shown before the input text

Prop

Type

Default

childrenstringNo default value

Input

The HTML input itself

Prop

Type

Default

childrenReactNodeNo default value

RightIcon

A feedback icon/text visibility toggler that sits on the right side of the input field.

Prop

Type

Default

activeIconReactNodeNo default value
inactiveIconReactNodeNo default value