Docs Version 1

<zg-search>

Version 1

Interactive Storybook Playground

The <zg-search> tag is a web component that is used to encapsulate the interface component necessary to search the grid. The element is added dynamically when search is specified and should not be directly inserted by the user. The search bar is styleable via CSS variables or the zg-search CSS selector.

Image of the DOM relationship for the zg-search web component tag

ZGSearch Relationships
Component Relationship Type Ancestor

Related Web Components

Usage

A <zg-search> tag can be triggered by adding the search attribute on the <zing-grid> tag, like so:

<zing-grid search
  src="https://cdn.zinggrid.com/datasets/user-roles.json">
</zing-grid>
Top

Attributes

There are no attributes available for the <zg-search> web component.

Top

CSS Variables

<zg-search> can be styled with CSS variables, like so:

:root {
  --zg-search-background: red;
}

Below is a list of all the associated --zg-search CSS variables. Check out the full list of CSS variables or our Styling Basics guide to learn more about styling the grid.

ZGSearch CSS Variables and Default Values
Name Default Description Demo CSS Ref
--zg-search-background Browser's default value Styles the background of search input field
--zg-search-border 0 Styles the border of search input field
--zg-search-border-bottom var(--zg-search-border, 0) Styles the bottom border of search input field
--zg-search-border-left var(--zg-search-border, 0) Styles the left border of search input field
--zg-search-border-radius 0 Applies border radius to search input field
--zg-search-border-right var(--zg-search-border, 0) Styles the right border of search input field
--zg-search-border-top var(--zg-search-border, 0) Styles the top border of search input field
--zg-search-color var(--theme-color_alt) Sets the font color of search input field
--zg-search-font-size vd Sets the font size of search input field
--zg-search-font-weight var(--theme-font-weight) Sets the font weight of search input field
--zg-search-height 32px Sets the height of search input field
--zg-search-padding 0 10px 0 15px Sets the padding of search input field
Top

CSS Selector

<zg-search> can be styled by common CSS selectors, like so:

zg-search {
  background: red;
}
Top

CSS Shadow Parts

<zg-search> exposed elements within the shadow can be styled by CSS shadow parts, like so:

zg-search::part(search) {
  background-color: red;
}

Below is a list of all the associated ZGSearch shadow parts. Check out the full list of CSS shadow parts or our Styling Basics guide to learn more about styling the grid.

ZGSearch CSS Shadow Parts
Name Description
input The container for the search input field
search The container for the search
Top

Slots

There are no slots available for the <zg-search> web component.

Top

[api: <zg-search>]