suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
  • AI
GitHubCreate
DocsComponentsPatternsInteractionsChartsBlocksAICreate
Components84
  • Overview
  • Accordion
  • Alert
  • Alert Dialog
  • Alert Sheet
  • Amount Input
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Bottom Bar
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Chip
  • Code Block
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Dialog
  • Direction
  • Drawer
  • Dropdown Menu
  • Empty
  • FAB
  • Field
  • Fullscreen Menu
  • Haptics
  • Header
  • Hover Card
  • Icon
  • Input
  • Input Accessory Bar
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Keyboard Scroll View
  • Keypad
  • Label
  • Marker
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Page Indicator
  • Pagination
  • Pin Pad
  • Popover
  • Progress
  • QR Scanner
  • Questionnaire
  • Radio Group
  • Resizable
  • Screen
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature Pad
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Tab Bar
  • Table
  • Tabs
  • Text
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Trace
  • Wheel Picker
  • Widget

suiss/ui · Component

Input Accessory Bar

A toolbar above the keyboard with previous, next and done buttons for moving through form fields.

Input Accessory Bar is an open-source component from suiss/ui for React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

React Native
Input accessory bar demo in React Native, light modeInput accessory bar demo in React Native, dark mode
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

export default function InputAccessoryBarDemo() {
  return (
    <InputAccessoryBar>
      <KeyboardScrollView
        className="-m-4"
        contentContainerClassName="gap-4 p-4"
      >
        <View className="gap-1.5">
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

export default function InputAccessoryBarDemo() {
  return (
    <InputAccessoryBar>
      <KeyboardScrollView
        style={{ margin: -16 }}
        contentContainerStyle={{ gap: 16, padding: 16 }}
      >
        <View style={{ gap: 6 }}>
import SwiftUI

enum InputAccessoryBarField: Hashable {
  case name, email, phone, city, subject, message
}

struct InputAccessoryBarRow: View {
  let label: LocalizedStringKey
  let field: InputAccessoryBarField
  let focus: FocusState<InputAccessoryBarField?>.Binding

  @State private var text = ""

  var body: some View {
    VStack(alignment: .leading, spacing: 6) {
      Text(label)
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.unit.dp

InputAccessoryBar connects a set of inputs and shows a bar above the keyboard while one of them is focused. The up and down arrows move focus to the previous or next input, and the done button dismisses the keyboard.

On iOS the bar is a native InputAccessoryView, attached to the keyboard. On Android it is rendered through a portal and positioned just above the keyboard while an input is focused.

Installation

$ pnpm dlx shadcn@latest add @esuiss/input-accessory-bar

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add input-accessory-bar
$ pnpm dlx shadcn@latest add @esuiss/input-accessory-bar

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add input-accessory-bar --platform swift
$ pnpm dlx shadcn@latest add @esuiss/input-accessory-bar

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add input-accessory-bar --platform kotlin

The CLI also adds what it builds on: Button, Icon, Input, Keyboard Scroll View, Text.

  1. Install the following dependencies:
npx expo install cn phosphor-react-native react-native-svg
  1. Add the pieces it builds on: Button, Icon, Input, Keyboard Scroll View, Text.

  2. Copy the primitives it uses into components/primitives:

uniwind/components/primitives/haptics.tsx
import * as React from "react"

type HapticsImpactStyle = "light" | "medium" | "heavy" | "soft" | "rigid"

type HapticsNotificationType = "success" | "warning" | "error"

interface HapticsAdapter {
  impact(style: HapticsImpactStyle): void
  selection(): void
  notification(type: HapticsNotificationType): void
}

interface HapticsContextValue {
  adapter: HapticsAdapter | null
  enabled: boolean
}
uniwind/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
uniwind/components/primitives/keyboard.ts
import * as React from "react"
import {
  Dimensions,
  Keyboard,
  type KeyboardEvent,
  type KeyboardMetrics,
  Platform,
  useWindowDimensions,
} from "react-native"

interface KeyboardFrame {
  height: number
  accessoryHeight: number
  duration: number
}
uniwind/components/primitives/portal.tsx
import * as React from "react"
import { HapticsContext } from "./haptics"

const DEFAULT_PORTAL_HOST = "INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME"

type PortalEntries = ReadonlyMap<string, React.ReactNode>

const EMPTY_ENTRIES: PortalEntries = new Map()

let hosts: ReadonlyMap<string, PortalEntries> = new Map()
const listeners = new Set<() => void>()

function emit() {
  for (const listener of listeners) listener()
}
  1. Copy and paste the following code into components/ui/input-accessory-bar.tsx:
uniwind/components/ui/input-accessory-bar.tsx
import { cn } from "cn"
import { CaretDownIcon, CaretUpIcon } from "phosphor-react-native"
import * as React from "react"
import {
  I18nManager,
  InputAccessoryView,
  Keyboard,
  Platform,
  type TextInput,
  type TextInputProps,
  View,
} from "react-native"
import { useComposedRefs } from "@/components/primitives/hooks"
import {
  setKeyboardAccessoryHeight,
  useKeyboard,
  1. Update the import paths to match your project setup.
  1. Install the following dependencies:
npx expo install cn phosphor-react-native react-native-svg
  1. Add the pieces it builds on: Button, Icon, Input, Keyboard Scroll View, Text.

  2. Copy the primitives it uses into components/primitives:

nativewind/components/primitives/haptics.tsx
import * as React from "react"

type HapticsImpactStyle = "light" | "medium" | "heavy" | "soft" | "rigid"

type HapticsNotificationType = "success" | "warning" | "error"

interface HapticsAdapter {
  impact(style: HapticsImpactStyle): void
  selection(): void
  notification(type: HapticsNotificationType): void
}

interface HapticsContextValue {
  adapter: HapticsAdapter | null
  enabled: boolean
}
nativewind/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
nativewind/components/primitives/keyboard.ts
import * as React from "react"
import {
  Dimensions,
  Keyboard,
  type KeyboardEvent,
  type KeyboardMetrics,
  Platform,
  useWindowDimensions,
} from "react-native"

interface KeyboardFrame {
  height: number
  accessoryHeight: number
  duration: number
}
nativewind/components/primitives/portal.tsx
import * as React from "react"
import { HapticsContext } from "./haptics"

const DEFAULT_PORTAL_HOST = "INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME"

type PortalEntries = ReadonlyMap<string, React.ReactNode>

const EMPTY_ENTRIES: PortalEntries = new Map()

let hosts: ReadonlyMap<string, PortalEntries> = new Map()
const listeners = new Set<() => void>()

function emit() {
  for (const listener of listeners) listener()
}
  1. Copy and paste the following code into components/ui/input-accessory-bar.tsx:
nativewind/components/ui/input-accessory-bar.tsx
import { cn } from "cn"
import { CaretDownIcon, CaretUpIcon } from "phosphor-react-native"
import * as React from "react"
import {
  I18nManager,
  InputAccessoryView,
  Keyboard,
  Platform,
  type TextInput,
  type TextInputProps,
  View,
} from "react-native"
import { useComposedRefs } from "@/components/primitives/hooks"
import {
  setKeyboardAccessoryHeight,
  useKeyboard,
  1. Update the import paths to match your project setup.
  1. Install the following dependencies:
npx expo install phosphor-react-native react-native-svg
  1. Add the pieces it builds on: Button, Icon, Input, Keyboard Scroll View, Text.

  2. Copy the primitives it uses into components/primitives:

stylesheet/components/primitives/haptics.tsx
import * as React from "react"

type HapticsImpactStyle = "light" | "medium" | "heavy" | "soft" | "rigid"

type HapticsNotificationType = "success" | "warning" | "error"

interface HapticsAdapter {
  impact(style: HapticsImpactStyle): void
  selection(): void
  notification(type: HapticsNotificationType): void
}

interface HapticsContextValue {
  adapter: HapticsAdapter | null
  enabled: boolean
}
stylesheet/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
stylesheet/components/primitives/keyboard.ts
import * as React from "react"
import {
  Dimensions,
  Keyboard,
  type KeyboardEvent,
  type KeyboardMetrics,
  Platform,
  useWindowDimensions,
} from "react-native"

interface KeyboardFrame {
  height: number
  accessoryHeight: number
  duration: number
}
stylesheet/components/primitives/portal.tsx
import * as React from "react"
import { HapticsContext } from "./haptics"

const DEFAULT_PORTAL_HOST = "INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME"

type PortalEntries = ReadonlyMap<string, React.ReactNode>

const EMPTY_ENTRIES: PortalEntries = new Map()

let hosts: ReadonlyMap<string, PortalEntries> = new Map()
const listeners = new Set<() => void>()

function emit() {
  for (const listener of listeners) listener()
}
  1. Copy and paste the following code into components/ui/input-accessory-bar.tsx:
stylesheet/components/ui/input-accessory-bar.tsx
import { CaretDownIcon, CaretUpIcon } from "phosphor-react-native"
import * as React from "react"
import {
  I18nManager,
  InputAccessoryView,
  Keyboard,
  Platform,
  type StyleProp,
  StyleSheet,
  type TextInput,
  type TextInputProps,
  View,
  type ViewStyle,
} from "react-native"
import { useComposedRefs } from "@/components/primitives/hooks"
import {
  1. Update the import paths to match your project setup.
  1. Target iOS 17 or later.

  2. Add the Swift package to your app:

Package.swift
.package(url: "https://github.com/phosphor-icons/swift", from: "2.1.0")
  1. Copy the theme files every view uses:
swift/Theme/Theme.swift
import CoreText
import SwiftUI
import UIKit

struct RGBA: Sendable {
  let red: CGFloat
  let green: CGFloat
  let blue: CGFloat
  let alpha: CGFloat

  init(_ hex: UInt32, _ alpha: CGFloat = 1) {
    red = CGFloat((hex >> 16) & 0xFF) / 255
    green = CGFloat((hex >> 8) & 0xFF) / 255
    blue = CGFloat(hex & 0xFF) / 255
    self.alpha = alpha
  }
swift/Theme/Tokens.swift
import SwiftUI

public enum EsuissColor {
  public static let background = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x000000))
  public static let foreground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let card = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F))
  public static let cardForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let popover = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F))
  public static let popoverForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let primary = Color.adaptive(light: .init(0x0071E3), dark: .init(0x0A84FF))
  public static let primaryForeground = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0xFFFFFF))
  public static let secondary = Color.adaptive(light: .init(0x000000, 0.04), dark: .init(0xFFFFFF, 0.1))
  public static let secondaryForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let muted = Color.adaptive(light: .init(0xF5F5F7), dark: .init(0x161617))
  public static let mutedForeground = Color.adaptive(light: .init(0x6E6E73), dark: .init(0x86868B))
  public static let accent = Color.adaptive(light: .init(0x000000, 0.06), dark: .init(0xFFFFFF, 0.1))
  1. Copy the source and every file it uses:
swift/Components/InputAccessoryBar.swift
import PhosphorSwift
import SwiftUI

struct FocusChain<Value: Hashable> {
  let order: [Value]

  func next(after value: Value?) -> Value? {
    guard let value, let index = order.firstIndex(of: value) else { return order.first }
    let target = order.index(after: index)
    return target < order.endIndex ? order[target] : nil
  }

  func previous(before value: Value?) -> Value? {
    guard let value, let index = order.firstIndex(of: value) else { return nil }
    return index > order.startIndex ? order[order.index(before: index)] : nil
  }
swift/Components/Checkbox.swift
import PhosphorSwift
import SwiftUI

extension Shadow {
  static let control = Shadow(color: .black.opacity(0.08), radius: 0.5, y: 0.5)
  static let thumb = Shadow(color: .black.opacity(0.12), radius: 1.5, y: 1)
}

struct SelectionIndicator<Mark: View>: View {
  let checked: Bool
  let pressed: Bool
  let cornerRadius: CGFloat
  let mark: Mark

  @Environment(\.isEnabled) private var isEnabled
  @Environment(\.isInvalid) private var invalid
swift/Components/Field.swift
import SwiftUI

extension EnvironmentValues {
  @Entry public var isInvalid = false
  @Entry var fieldInset = false
  @Entry var fieldSize = FieldSize.default
  @Entry var fieldGroupInset = false
  @Entry var fieldSetInset = false
}

extension View {
  public func invalid(_ isInvalid: Bool = true) -> some View {
    environment(\.isInvalid, isInvalid)
  }
}
swift/Components/Haptics.swift
import SwiftUI

extension EnvironmentValues {
  @Entry public var hapticsEnabled = true
}

extension View {
  public func haptics(_ enabled: Bool) -> some View {
    environment(\.hapticsEnabled, enabled)
  }

  func hapticFeedback<Trigger: Equatable>(_ feedback: SensoryFeedback, trigger: Trigger) -> some View {
    modifier(HapticFeedbackModifier(feedback: feedback, trigger: trigger) { _, _ in true })
  }

  func hapticFeedback<Trigger: Equatable>(
swift/Components/Separator.swift
import SwiftUI

public struct Separator: View {
  let orientation: Axis

  public init(_ orientation: Axis = .horizontal) {
    self.orientation = orientation
  }

  public var body: some View {
    Rectangle()
      .fill(EsuissColor.border)
      .frame(width: orientation == .vertical ? 1 : nil, height: orientation == .horizontal ? 1 : nil)
      .frame(maxWidth: orientation == .horizontal ? .infinity : nil, maxHeight: orientation == .vertical ? .infinity : nil)
      .accessibilityHidden(true)
  }
  1. Add the files to your app target.
  1. Apply the Compose compiler plugin, enable Compose, set compileSdk to 37 or higher and minSdk to 24 or higher, and add the dependencies:
build.gradle.kts
plugins {
    id("org.jetbrains.kotlin.plugin.compose")
}

android {
    compileSdk = 37
    defaultConfig { minSdk = 24 }
    buildFeatures { compose = true }
}

dependencies {
    implementation(platform("androidx.compose:compose-bom:2026.09.00"))
    implementation("androidx.compose.foundation:foundation")
    implementation("androidx.compose.ui:ui")
    implementation("com.adamglin:phosphor-icon-android:1.0.0")
}
  1. Copy the theme files every view uses:
kotlin/theme/Theme.kt
package com.esuiss.ui.theme

import android.content.res.AssetManager
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.dropShadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.shadow.Shadow as DropShadow
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
kotlin/theme/Tokens.kt
package com.esuiss.ui.theme

import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp

@Immutable
data class Colors(
    val background: Color,
    val foreground: Color,
    val card: Color,
    val cardForeground: Color,
    val popover: Color,
    val popoverForeground: Color,
    val primary: Color,
  1. Copy the source and every file it uses:
kotlin/components/InputAccessoryBar.kt
package com.esuiss.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.relocation.BringIntoViewRequester
import androidx.compose.foundation.relocation.bringIntoViewRequester
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
kotlin/components/Button.kt
package com.esuiss.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicText
kotlin/components/ButtonGroup.kt
package com.esuiss.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.Immutable
kotlin/components/Content.kt
package com.esuiss.ui.components

import androidx.compose.runtime.compositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

val LocalContentStyle = compositionLocalOf { TextStyle.Default }

val LocalContentColor = compositionLocalOf { Color.Unspecified }

val LocalIconSize = compositionLocalOf { 20.dp }
kotlin/components/Icon.kt
package com.esuiss.ui.components

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.takeOrElse
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.Dp
import com.esuiss.ui.theme.EsuissTheme

@Composable
fun Icon(
    imageVector: ImageVector,
kotlin/components/Screen.kt
package com.esuiss.ui.components

import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.os.Build
import android.view.View
import android.view.Window
import android.view.WindowInsetsController
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.ColumnScope
  1. Update the com.esuiss.ui package names to match your project.

Usage

import { View } from "react-native"
import { InputAccessoryBar, InputAccessoryBarInput } from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

function Field({ label, autoFocus }: { label: string; autoFocus?: boolean }) {
  return (
    <View className="gap-1.5">
      <Text variant="small">{label}</Text>
      <InputAccessoryBarInput placeholder={label} autoFocus={autoFocus} />
    </View>
  )
}

function Form({ autoFocus = false }: { autoFocus?: boolean }) {
  return (
    <KeyboardScrollView className="-m-4" contentContainerClassName="gap-4 p-4">
      <Field label="Name" autoFocus={autoFocus} />
      <Field label="Email" />
      <Field label="Phone" />
      <Field label="City" />
    </KeyboardScrollView>
  )
}

export function InputAccessoryBarExample() {
  return (
    <InputAccessoryBar>
      <Form />
    </InputAccessoryBar>
  )
}
import { View } from "react-native"
import { InputAccessoryBar, InputAccessoryBarInput } from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

function Field({ label, autoFocus }: { label: string; autoFocus?: boolean }) {
  return (
    <View style={{ gap: 6 }}>
      <Text variant="small">{label}</Text>
      <InputAccessoryBarInput placeholder={label} autoFocus={autoFocus} />
    </View>
  )
}

function Form({ autoFocus = false }: { autoFocus?: boolean }) {
  return (
    <KeyboardScrollView style={{ margin: -16 }} contentContainerStyle={{ gap: 16, padding: 16 }}>
      <Field label="Name" autoFocus={autoFocus} />
      <Field label="Email" />
      <Field label="Phone" />
      <Field label="City" />
    </KeyboardScrollView>
  )
}

export function InputAccessoryBarExample() {
  return (
    <InputAccessoryBar>
      <Form />
    </InputAccessoryBar>
  )
}
import SwiftUI

enum InputAccessoryBarField: Hashable {
  case name, email, phone, city, subject, message
}

struct InputAccessoryBarRow: View {
  let label: LocalizedStringKey
  let field: InputAccessoryBarField
  let focus: FocusState<InputAccessoryBarField?>.Binding

  @State private var text = ""

  var body: some View {
    VStack(alignment: .leading, spacing: 6) {
      Text(label)
        .textVariant(.small)
        .accessibilityHidden(true)
      TextField(label, text: $text)
        .textFieldStyle(.input)
        .focused(focus, equals: field)
        .submitLabel(.next)
    }
  }
}

struct InputAccessoryBarForm: View {
  var autoFocus = false
  var previousLabel: LocalizedStringKey = "Previous"
  var nextLabel: LocalizedStringKey = "Next"
  var doneLabel: LocalizedStringKey = "Done"

  @FocusState private var focus: InputAccessoryBarField?

  var body: some View {
    KeyboardScrollView {
      VStack(alignment: .leading, spacing: 16) {
        InputAccessoryBarRow(label: "Name", field: .name, focus: $focus)
        InputAccessoryBarRow(label: "Email", field: .email, focus: $focus)
        InputAccessoryBarRow(label: "Phone", field: .phone, focus: $focus)
        InputAccessoryBarRow(label: "City", field: .city, focus: $focus)
      }
      .padding(16)
    }
    .inputAccessoryBar(
      focus: $focus,
      order: [.name, .email, .phone, .city],
      previousLabel: previousLabel,
      nextLabel: nextLabel,
      doneLabel: doneLabel
    )
    .onAppear {
      if autoFocus { focus = .name }
    }
  }
}
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.unit.dp
import com.esuiss.ui.components.Input
import com.esuiss.ui.components.InputAccessoryBar
import com.esuiss.ui.components.InputAccessoryState
import com.esuiss.ui.components.KeyboardScrollView
import com.esuiss.ui.components.Screen
import com.esuiss.ui.components.Text
import com.esuiss.ui.components.TextVariant
import com.esuiss.ui.components.inputAccessory
import com.esuiss.ui.components.rememberInputAccessoryState

@Composable
fun InputAccessoryBarExample() {
    InputAccessoryBarForm(autoFocus = false)
}

@Composable
fun InputAccessoryBarField(
    label: String,
    state: InputAccessoryState,
    index: Int,
    autoFocus: Boolean = false,
) {
    var value by rememberSaveable(label) { mutableStateOf("") }
    val requester = remember { FocusRequester() }
    if (autoFocus) {
        LaunchedEffect(Unit) { requester.requestFocus() }
    }
    Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
        Text(label, variant = TextVariant.Small)
        Input(
            value,
            { value = it },
            Modifier.focusRequester(requester).inputAccessory(state, index),
            placeholder = label,
        )
    }
}

@Composable
fun InputAccessoryBarForm(
    autoFocus: Boolean,
    previousLabel: String = "Previous",
    nextLabel: String = "Next",
    doneLabel: String = "Done",
) {
    val state = rememberInputAccessoryState()
    Screen {
        KeyboardScrollView(
            modifier = Modifier.fillMaxSize(),
            contentPadding = PaddingValues(16.dp),
            verticalArrangement = Arrangement.spacedBy(16.dp),
        ) {
            InputAccessoryBarField("Name", state, 0, autoFocus)
            InputAccessoryBarField("Email", state, 1)
            InputAccessoryBarField("Phone", state, 2)
            InputAccessoryBarField("City", state, 3)
        }
        InputAccessoryBar(state, previousLabel = previousLabel, nextLabel = nextLabel, doneLabel = doneLabel)
    }
}

Examples

Focused

The first input focused, so the bar is visible.

React Native
Input accessory bar focused in React Native, light modeInput accessory bar focused in React Native, dark mode
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

export default function InputAccessoryBarFocused() {
  return (
    <InputAccessoryBar>
      <KeyboardScrollView
        className="-m-4"
        contentContainerClassName="gap-4 p-4"
      >
        <View className="gap-1.5">
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

export default function InputAccessoryBarFocused() {
  return (
    <InputAccessoryBar>
      <KeyboardScrollView
        style={{ margin: -16 }}
        contentContainerStyle={{ gap: 16, padding: 16 }}
      >
        <View style={{ gap: 6 }}>
import SwiftUI

struct InputAccessoryBarFocusedExample: View {
  var body: some View {
    InputAccessoryBarForm(autoFocus: true)
  }
}

enum InputAccessoryBarField: Hashable {
  case name, email, phone, city, subject, message
}

struct InputAccessoryBarRow: View {
  let label: LocalizedStringKey
  let field: InputAccessoryBarField
  let focus: FocusState<InputAccessoryBarField?>.Binding
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.unit.dp

Custom labels

Use previousLabel, nextLabel and doneLabel to localize the buttons, and onDone to react when done is pressed.

React Native
Input accessory bar custom labels in React Native, light modeInput accessory bar custom labels in React Native, dark mode
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

export default function InputAccessoryBarCustomLabels() {
  return (
    <InputAccessoryBar
      previousLabel="Back"
      nextLabel="Forward"
      doneLabel="Close"
    >
      <KeyboardScrollView
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"

export default function InputAccessoryBarCustomLabels() {
  return (
    <InputAccessoryBar
      previousLabel="Back"
      nextLabel="Forward"
      doneLabel="Close"
    >
      <KeyboardScrollView
import SwiftUI

struct InputAccessoryBarCustomLabelsExample: View {
  var body: some View {
    InputAccessoryBarForm(autoFocus: true, previousLabel: "Back", nextLabel: "Forward", doneLabel: "Close")
  }
}

enum InputAccessoryBarField: Hashable {
  case name, email, phone, city, subject, message
}

struct InputAccessoryBarRow: View {
  let label: LocalizedStringKey
  let field: InputAccessoryBarField
  let focus: FocusState<InputAccessoryBarField?>.Binding
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.unit.dp

With textarea

For other text inputs, such as a Textarea, call useInputAccessoryBarInput() and spread the returned props onto the input.

React Native
Input accessory bar with textarea in React Native, light modeInput accessory bar with textarea in React Native, dark mode
import * as React from "react"
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
  useInputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"
import { Textarea } from "@/components/ui/textarea"

function MessageField() {
  const accessory = useInputAccessoryBarInput()
  return (
    <View className="gap-1.5">
      <Text variant="small">Message</Text>
import * as React from "react"
import { View } from "react-native"
import {
  InputAccessoryBar,
  InputAccessoryBarInput,
  useInputAccessoryBarInput,
} from "@/components/ui/input-accessory-bar"
import { KeyboardScrollView } from "@/components/ui/keyboard-scroll-view"
import { Text } from "@/components/ui/text"
import { Textarea } from "@/components/ui/textarea"
import { fontSize, useTheme } from "@/components/ui/theme"

function MessageField() {
  const accessory = useInputAccessoryBarInput()
  return (
    <View style={{ gap: 6 }}>
import SwiftUI

enum InputAccessoryBarField: Hashable {
  case name, email, phone, city, subject, message
}

struct InputAccessoryBarRow: View {
  let label: LocalizedStringKey
  let field: InputAccessoryBarField
  let focus: FocusState<InputAccessoryBarField?>.Binding

  @State private var text = ""

  var body: some View {
    VStack(alignment: .leading, spacing: 6) {
      Text(label)
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.semantics.LiveRegionMode

Accessibility

  • The arrow buttons are labelled with previousLabel and nextLabel and are disabled at the first and last input.
  • The done button is a text button that dismisses the keyboard.

API Reference

InputAccessoryBar

Provider that tracks the inputs and renders the bar.

PropTypeDefault
previousLabelstring"Previous"
nextLabelstring"Next"
doneLabelReact.ReactNode"Done"
onDone() => void-
portalHoststring-
classNamestring-
childrenReact.ReactNode-

Wrap the form in InputAccessoryBar. doneLabel can be text or a node, and onDone is called after the keyboard is dismissed. portalHost names the portal host the bar renders into on Android, where the bar also reserves its height so keyboard-aware layouts stay above it. Inside a Keyboard Scroll View, the focused input is scrolled into view.

InputAccessoryBarInput

Input connected to the bar.

PropTypeDefault
ordernumber-

Also accepts the props of React.ComponentProps<typeof Input>.

Use it in place of Input. order sets its position in the previous and next order; without it, inputs follow the order they mount. The return key reads "next" on every input but the last, which reads "done" and dismisses the keyboard.

InputAccessoryBar

Provider that tracks the inputs and renders the bar.

ParameterTypeDefault
previousLabelLocalizedStringKey"Previous"
nextLabelLocalizedStringKey"Next"
doneLabelLocalizedStringKey"Done"
onPrevious(() -> Void)?nil
onNext(() -> Void)?nil
onDone() -> Void-

.inputAccessoryBar

ParameterTypeDefault
focusFocusState<Value?>.Binding-
order[Value]-
previousLabelLocalizedStringKey"Previous"
nextLabelLocalizedStringKey"Next"
doneLabelLocalizedStringKey"Done"

InputAccessoryState

Takes no parameters.

PropertyType
hasPreviousBoolean
hasNextBoolean

InputAccessoryState.previous

Takes no parameters.

InputAccessoryState.next

Takes no parameters.

rememberInputAccessoryState

Takes no parameters.

Returns InputAccessoryState.

Modifier.inputAccessory

ParameterTypeDefault
stateInputAccessoryState-
indexInt-

Returns Modifier.

InputAccessoryBar

Provider that tracks the inputs and renders the bar.

ParameterTypeDefault
stateInputAccessoryState-
modifierModifierModifier
previousLabelString"Previous"
nextLabelString"Next"
doneLabelString"Done"
onDone(() -> Unit)?null
NextInput GroupPreviousInput

On this page

  1. 01Installation
  2. 02Usage
  3. 03Examples
    • Focused
    • Custom labels
    • With textarea
  4. 04Accessibility
  5. 05API Reference
    • InputAccessoryBar
    • InputAccessoryBarInput
    • InputAccessoryBar
    • .inputAccessoryBar
    • InputAccessoryState
    • InputAccessoryState.previous
    • InputAccessoryState.next
    • rememberInputAccessoryState
    • Modifier.inputAccessory
    • InputAccessoryBar