<zg-search>

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

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>

Attributes

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

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
NameDefaultDescriptionDemoCSS Ref
--zg-search-backgroundBrowser's default valueStyles the background of search input field
--zg-search-border0Styles the border of search input field
--zg-search-border-bottomvar(--zg-search-border, 0)Styles the bottom border of search input field
--zg-search-border-leftvar(--zg-search-border, 0)Styles the left border of search input field
--zg-search-border-radius0Applies border radius to search input field
--zg-search-border-rightvar(--zg-search-border, 0)Styles the right border of search input field
--zg-search-border-topvar(--zg-search-border, 0)Styles the top border of search input field
--zg-search-colorvar(--theme-color_alt)Sets the font color of search input field
--zg-search-font-sizevdSets the font size of search input field
--zg-search-font-weightvar(--theme-font-weight)Sets the font weight of search input field
--zg-search-height32pxSets the height of search input field
--zg-search-padding0 10px 0 15pxSets the padding of search input field
--zg-search-top50%Sets the position from the top to place search input field
--zg-search-transformtranslateY(-50%)Sets the transform property of search input

CSS Selector

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

zg-search {
  background: red;
}