import * as React from "react"; import Code from "../Code"; export default function Actions() { return (

Actions

When a user searches for something in kbar, the result is a list of actions. These actions are represented by a simple object data structure.

void; section?: string; parent?: ActionId | null | undefined; children?: ActionId[]; }`} />

kbar manages an internal state of action objects.

Actions can have nested actions, represented by children{" "} above. With this, we can do things like building a folder-like experience where toggling one action leads to displaying a "nested" list of other actions.

Static, global actions

kbar takes an initial list of actions when instantiated. This initial list is considered a static/global list of actions. These actions exist on each page of your site.

Dynamic actions

While it is good to have a set of actions registered up front and available globally, sometimes you will want to have actions available only when on a specific page, or even when a specific component is rendered.

Actions can be registered at runtime using the{" "} useRegisterActions hook. This dynamically adds and removes actions based on where the hook lives.

); }