LogoLogo
  • Release Notes
  • Downloads
  • Frequently Asked Questions
  • Developers
    • Introduction
    • Color Variables
    • Font Family
    • Vanilla JS
    • React
    • Vue
    • Angular
    • RTL Support
    • Light Mode/Dark Mode
  • Foundations
    • Typography
    • Colors
    • Icons & Visuals
    • Images
    • Layout & Breakpoints
    • Utils
    • Usability Guidelines
  • Components
    • Accordions
      • Accordion
      • Accordion Groups
    • Alert
    • Attach File
    • Avatar
    • Banner Cards
    • Breadcrumbs
    • Buttons
      • Button
      • Icon Button
      • Link Button
      • Social Media Buttons
      • Split Button
    • Checkbox
      • Checkbox Input
      • Checkbox Groups
    • Chips
    • Credit Card
    • Credit Card Input Field
    • Header
    • Interactive Banner
    • Number Field
    • Menu
    • Pagination
    • Phone Number Field
    • Progress Indicators
      • Expectation Levels
      • Progress Bar
      • Progress Circle
      • Progress Semi-Circle
    • Quick Select Field
    • Radio Buttons
      • Radio Input
      • Radio Buttons Groups
    • Search Input Field
    • Segmentation
      • Segmented Controls
      • Segmented Tabs
    • Select Input Field
    • Slider
    • Steps
      • Stepper
      • Step Indicator
    • Sticky Bar
    • Tabs
    • Text Area Field
    • Text Field
    • Toggle Switch
    • Tooltip
Powered by GitBook
On this page
  • Overview
  • Usage
  • When to use this component?
  • How it works
  • Code
  • Properties
  • Anatomy
  • Anatomy Options
  • Dos and Don'ts
Export as PDF
  1. Components

Search Input Field

Search Input Field is used to allow users to enter search queries and filter through content.

PreviousRadio Buttons GroupsNextSegmentation

Last updated 12 days ago

Overview

Usage

When to use this component?

Search fields are used in applications where users need to search for information, such as on websites, in databases, or in content-heavy applications. They are ideal for scenarios requiring quick and efficient information retrieval.

How it works

A search field component typically includes a label, an input area for entering search queries, and optional elements like a clear button and helper text for guidance. It may also feature different states, such as focused, filled, or error, to reflect its current status. Search fields enable users to quickly locate specific information by entering keywords or phrases, streamlining their search experience.

Code

<dda-search-input
    placeholder="Search"
    label="Search"
    size="default"
    helper_text="Helper or footer text"
    error_message=""
    show_button="false"
    has_error="false"
    custom_class=""
    component_mode=""
    button_id="button"
    aria_label="search-input"
    button_aria_label="clear-search"
    onchange=""
    search_input_name="search-input"
    close_button_name="close-button"
    search_button_name="search-button"
></dda-search-input>
<DdaSearchInput
    placeholder="Search"
    label="Search"
    size="default"
    helper_text="Helper or footer text"
    error_message=""
    show_button="false"
    has_error="false"
    custom_class=""
    component_mode=""
    button_id="button"
    aria_label="search-input"
    button_aria_label="clear-search"
    onchange=""
    search_input_name="search-input"
    close_button_name="close-button"
    search_button_name="search-button"
></DdaSearchInput>
<DdaSearchInput
    placeholder="Search"
    label="Search"
    size="default"
    helper_text="Helper or footer text"
    error_message=""
    show_button="false"
    has_error="false"
    custom_class=""
    component_mode=""
    button_id="button"
    aria_label="search-input"
    button_aria_label="clear-search"
    onchange=""
    search_input_name="search-input"
    close_button_name="close-button"
    search_button_name="search-button"
></DdaSearchInput>
<dda-search-input
    placeholder="Search"
    label="Search"
    size="default"
    helper_text="Helper or footer text"
    error_message=""
    show_button="false"
    has_error="false"
    custom_class=""
    component_mode=""
    button_id="button"
    aria_label="search-input"
    button_aria_label="clear-search"
    onchange=""
    search_input_name="search-input"
    close_button_name="close-button"
    search_button_name="search-button"
></dda-search-input>

Properties

Property
Description
Type

aria_label

The aria-label attribute for the search input element, used to enhance accessibility by providing a textual description.

string

button_aria_label

The aria-label attribute for the buttons in the component, which helps provide a clear description for screen readers.

string

button_id

The ID to be assigned to the button elements for accessibility and targeting purposes.

string

component_mode

An optional property for specifying a particular mode or variant of the component, which can be used to alter its appearance or behavior based on the context.

string

custom_class

A string of additional custom CSS classes that can be applied to the input container for further styling customization.

string

error_message

Custom error message displayed when the input field has an error. Appears below the input if has_error is true.

string

has_error

A boolean flag indicating whether the input field has an error. If true, it triggers error styling and the error message display.

boolean

helper_text

Text displayed below the input field to assist users, such as instructions or tips.

string

input_status

Specifies the status of the input field, e.g., "valid" or "invalid". This can be used to apply custom styling based on the field’s state.

string

label

The label text for the search input. This label is displayed above the input field.

string

placeholder

The placeholder text to be displayed inside the input field when it is empty. Default is "Search".

string

show_button

A boolean flag to control the visibility of the "Search" button. If true, the button is shown; otherwise, it is hidden.

boolean

size

Specifies the size of the input field. Default is 'sm' (small). Can be adjusted to other sizes like 'md' (medium) or 'lg' (large) depending on the desired appearance.

string

search_input_name

Name attribute for the search input field

string

close_button_name

Name attribute for the close button

string

search_button_name

Name attribute for the search button

string

Anatomy

Anatomy Options

Label: Describes the function or purpose of the search field, here labeled as "Search."

Lead-Icon: An icon placed at the beginning of the input field, usually representing the action or purpose, like a magnifying glass for search.

Placeholder: Text that appears within the input field when it’s empty, providing a hint or example for what to type, such as "Search."

Button: A clickable element labeled "Search" that initiates the search action when pressed.

Caption: Additional helper or footer text below the field, providing more context or instructions to the user.

Dos and Don'ts

Dos
Don'ts

Use search fields to allow users to quickly find specific information.

Don't use search fields for inputs that are not related to search or query purposes.

Label the search field clearly to indicate its purpose.

Avoid using ambiguous or unclear labels for search fields.

Include a placeholder text to guide users on what to search for.

Don't rely solely on placeholder text for essential instructions.

Provide a clear button to allow users to quickly clear the search input.

Don't omit the clear button if the search input field is long or complex.

Ensure the search field is large enough to be easily tappable or clickable.

Avoid making the search field too small to interact with comfortably.

Use helper text to provide additional context or instructions, if necessary.

Don't overload the search field with too much information.

Validate input and provide clear error messages when necessary.

Don't provide generic error messages that don't help users understand the issue.

Keep consistent styling and spacing across all search fields in the application.

Don't use inconsistent styles that may confuse users.