LyteNyte Grid logo for light mode. Links back to the documentation home page.
Components

Select All

LyteNyte Grid provides a checkbox component for selecting all rows in the grid. Use this component to easily display indeterminate and selected states.

Info

This guide assumes you are familiar with how row selection works in LyteNyte Grid. See the Row Selection guide for more details.

Rendering Select All

LyteNyte Grid exports the SelectAll component. This component is intended for use in a grid column header, but you can use it in any component that has access to the grid API.

The demo below shows the SelectAll component in action. The checkbox rendered in the marker column header selects all rows when checked.

Select All

Fork code on stack blitzFork code on code sandbox

The code for the SelectAll component is shown below. The Checkbox component is also exported from LyteNyte Grid and simplifies rendering indeterminate checkbox states. You may use your own checkbox component if you prefer.

<SelectAll
api={params.api}
slot={({ indeterminate, selected, toggle }) => {
return (
<Checkbox
checked={selected}
indeterminate={indeterminate}
onClick={(ev) => {
ev.preventDefault();
toggle();
}}
onKeyDown={(ev) => {
if (ev.key === "Enter" || ev.key === " ") toggle();
}}
/>
);
}}
/>

Why Use The Select All Component

The SelectAll component automatically manages all selection states for you. LyteNyte Grid supports two selection modes: linked selection and isolated selection. The logic for determining whether all rows are selected differs between these modes.

The SelectAll component abstracts these differences and provides a consistent interface for determining whether all rows are selected, whether the selection state is indeterminate, and for performing the correct select-all action.

Properties

The SelectAll component accepts the following properties.

Prop

Next Steps

  • Menu Button: Display a list of actions or options in an accessible dropdown menu.
  • Smart Select: Streamline data selection using a versatile combobox or select element.
  • Pill Manager: Create and manage grid interactions using label pills.