experiment_id: web-retrieval-v1
fixture_id: /docs/v1/api/tags/zg-focus
mode: provenance
representation: html
origin_response_id: 2b419ba22b293715ca7b7113dd98ade2
version: 2026-10-21
version_created_at_utc: 2026-10-21T20:42:35.761Z
version_nonce: 66833063b969b4626fd0c36f51d71330
generated_at_utc: 2026-10-24T00:48:47.360Z
response_nonce: ddf8985567959a4bba4ccfb7c3ca34b1
Docs Version 1

<zg-focus>

Version 1

Interactive Storybook Playground

The <zg-focus> tag is a web component that is used as a container for the focus of cell(s) and used as a CSS target for styling by the developer. The <zg-focus> web component should not be accessed specifically beyond styling.

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

ZGFocus Relationships
Component Relationship Type Ancestor
ZingGrid Parent Generated n/a

Related Web Components

Usage

The <zg-focus> element is a generated element added to <zing-grid> when the selector attribute is defined.

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

Attributes

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

Top

CSS Variables

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

:root {
--zg-focus-border-top: 1px solid red;
}

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

ZGFocus CSS Variables and Default Values
Name Default Description Demo CSS Ref
--zg-focus-border 2px solid var(--theme-color-primary) Styles the border of cells on focus
--zg-focus-border-bottom var(--zg-focus-border, 2px solid var(--theme-color-primary)) Sets the bottom border of cells on focus
--zg-focus-border-left var(--zg-focus-border, 2px solid var(--theme-color-primary)) Sets the left border of cells on focus
--zg-focus-border-right var(--zg-focus-border, 2px solid var(--theme-color-primary)) Sets the right border of cells on focus
--zg-focus-border-top var(--zg-focus-border, 2px solid var(--theme-color-primary)) Sets the top border of cells on focus
--zg-focus-bottom-transform none Sets the transform of bottom border of cells on focus
--zg-focus-left-transform none Sets the transform of left border of cells on focus
--zg-focus-right-transform none Sets the transform of right border of cells on focus
--zg-focus-top-transform none Sets the transform of top border of cells on focus
Top

CSS Selector

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

zg-focus {
  border: 1px solid red;
}
Top

CSS Shadow Parts

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

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

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

ZGFocus CSS Shadow Parts
Name Description
bottom The bottom edge of the focus
focus Focus container
left The left edge of the focus
right The right edge of the focus
top The top edge of the focus
Top

Slots

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

Top

[api: <zg-focus>]