import * as React from "react"; import { useLocation } from "react-router-dom"; import Code from "../Code"; import { useKBar } from "../../../src/useKBar"; export default function APIReference() { const { disabled, query } = useKBar((state) => ({ disabled: state.disabled, })); return (
Internal state management for all of kbar. It is built on top of a small
publish/subscribe model in order to give us the ability to only re
render components that hook into kbar state through the use of the
public facing useKBar hook. Components which do not hook
into the internal kbar state will never re render.
Context provider for easy access to the internal state anywhere within the app tree.
Renders the contents of kbar in a DOM element outside of the root app element.
Handles all animations; showing, hiding, height scaling using the Web Animations API.
Renders an input which controls the internal search query state.
Renders a virtualized list of results.
Accepts a collector function to retrieve specific values from state. Only re renders the component when return value deeply changes. All kbar components are built using this hook.
For instance, let's disable kbar at any given time.
({
disabled: state.disabled
}));
return
}
`}
/>
Try it!
An internal history implementation which maintains a simple in memory
list of actions that contain an undoable, negatable action.