BNA

BNA UI
22

A styled text input component with label, validation, icons, and grouped layouts.

Component input-demo does not have a preview available.

Installation

pnpm dlx bna-ui add input

Usage

import { Input, GroupedInput, GroupedInputItem } from '@/components/ui/input';
<Input label='Username' placeholder='Enter your username' icon={User} />

Examples

Default

Component input-demo does not have a preview available.

With Icons

Component input-icons does not have a preview available.

Variants

Component input-variants does not have a preview available.

Validation States

Component input-validation does not have a preview available.

Right Components

Component input-right-components does not have a preview available.

Disabled State

Component input-disabled does not have a preview available.

Grouped Inputs

Component input-grouped does not have a preview available.

Form Example

Component input-form does not have a preview available.

API Reference

Input

The main input component with label, validation, and icon support.

PropTypeDefaultDescription
labelstring-Label text displayed inside the input
errorstring-Error message to display below the input
iconReact.ComponentType<LucideProps>-Lucide icon component to display on the left
rightComponentReactNode | (() => ReactNode)-Component or function returning component for right side
containerStyleViewStyle-Style for the outer container
inputStyleTextStyle-Style for the text input
labelStyleTextStyle-Style for the label text
errorStyleTextStyle-Style for the error message
variant'filled' | 'outline''filled'Visual variant of the input
disabledbooleanfalseWhether the input is disabled

Extends all TextInputProps except style.

GroupedInput

Container component for grouping multiple inputs together.

PropTypeDefaultDescription
childrenReactNode-Child components (usually GroupedInputItem)
containerStyleViewStyle-Style for the container
titlestring-Optional title for the group
titleStyleTextStyle-Style for the title text

GroupedInputItem

Input component designed to be used within GroupedInput.

PropTypeDefaultDescription
labelstring-Label text displayed inside the input
errorstring-Error message (displayed at group level)
iconReact.ComponentType<LucideProps>-Lucide icon component to display on the left
rightComponentReactNode | (() => ReactNode)-Component or function returning component for right side
inputStyleTextStyle-Style for the text input
labelStyleTextStyle-Style for the label text
errorStyleTextStyle-Style for the error message
disabledbooleanfalseWhether the input is disabled

Extends all TextInputProps except style.

Accessibility

The Input component is built with accessibility in mind:

  • Proper focus management and keyboard navigation
  • Screen reader support with semantic labeling
  • High contrast support for error states
  • Proper touch targets for mobile devices
  • Support for dynamic text sizing
  • Keyboard shortcuts and hardware keyboard support

Styling

The Input component uses your theme colors and can be customized:

  • filled variant: Uses card background with subtle borders
  • outline variant: Transparent background with prominent borders
  • Error states: Uses danger/red theme color
  • Focus states: Uses primary theme color
  • Disabled states: Reduced opacity with muted colors

Best Practices

  • Use clear, descriptive labels
  • Provide helpful placeholder text
  • Show validation errors immediately after user interaction
  • Group related inputs using GroupedInput
  • Use appropriate input types (email, password, etc.)
  • Consider using icons to clarify input purpose
  • Ensure sufficient contrast for accessibility