MaterialUIKit
Github
  • MaterialUIKit
  • Essentials
    • Configuring and Personalizing
    • Defining a Custom Color Schemes
  • Configuration and Color Schemes
    • MUIKitConfiguration
    • MUIKitColorScheme
  • Components
    • Action Button
      • ActionButtonStyle
    • Checkbox
    • Collection
      • CollectionStyle
    • Container
    • Date Selector
    • Dialog
    • Dialog Sheet
    • Dropdown Menu
      • Dropdown Menu Label
    • FAB
    • Icon Button
      • IconButtonStyle
    • Navigation Container
      • NavigationContainerHeaderStyle
      • Navigation Route
      • Navigation Route Label
    • Progress Bar
    • Radio Buttons Group
    • Search Box
    • Secure Text Box
    • Segmented Buttons
    • Separator
      • SeparatorOrientationStyle
    • Snackbar
    • Switch
    • Time Selector
    • Text Box
    • Tab Bar
      • TabBar Item
Powered by GitBook
On this page
  • Overview
  • Initializers
  • Parameters
  • Example
  1. Components

Search Box

Represents a Material UI styled search box for user input and search actions.

Overview

The SearchBox view provides a customizable search bar with Material UI styling. A search button appears when text is entered, allowing users to trigger a search action.

To use the SearchBox, initialize it with a binding to the search text and a closure for the search action. Optionally, provide a custom placeholder text.

Initializers

Creates a search box with a default placeholder text.

SearchBox(searchText: Binding<String>, _ action: @escaping () -> Void)

Creates a search box with a custom placeholder text.

SearchBox(
   _ placeholder: String,
   searchText: Binding<String>,
   _ action: @escaping () -> Void
)

Parameters

Parameter

Description

placeholder

The placeholder text to display when the search bar is empty.

searchText

A binding to the text that the user enters into the search bar.

action

A closure to execute when the user triggers the search action.

Example

Displays a search box with default placeholder text.

SearchBox(searchText: $query) {
    Void()
}

Displays a search box with custom placeholder.

SearchBox("Search here", searchText: $query) {
    Void()
}
PreviousRadio Buttons GroupNextSecure Text Box

Last updated 10 months ago