TidalUI

Prompt library preview

Browse reusable prompts, fill in their variables and select a finished prompt.

pro · Blocks · composite

When to use

Alternatives

Configure components.json and the @tidal-pro namespace before installing Pro components.

Installation

npx shadcn@latest add @tidal-pro/prompt-library

Import components/ui/tidal.css, components/ui/prompt-library.css. Wrap installed components in tidal-scope.

Preview

Prompt library component preview

Open interactive preview

Minimal example

import"./components/ui/tidal.css";
import"./components/ui/prompt-library.css";
import{TidalPromptLibrary}from"./components/ui/prompt-library";
export default(p:Parameters<typeof TidalPromptLibrary>[0])=><div className="tidal-scope"><TidalPromptLibrary {...p}/></div>;

API and props

TidalPromptLibrary.categories (required)
ReadonlyArray<TidalPromptCategory>

Required categories value accepted by this exported component.

TidalPromptLibrary.categoryId (required)
string

Required category id value accepted by this exported component.

TidalPromptLibrary.favorites (required)
ReadonlyArray<string>

Required favorites value accepted by this exported component.

TidalPromptLibrary.favoritesOnly (required)
boolean

Required favorites only value accepted by this exported component.

TidalPromptLibrary.onCategoryChange (required)
(id: string) => void

Callback invoked when the category change interaction is proposed.

TidalPromptLibrary.onFavoriteChange (required)
(id: string, saved: boolean) => void

Callback invoked when the favorite change interaction is proposed.

TidalPromptLibrary.onFavoritesOnlyChange (required)
(only: boolean) => void

Callback invoked when the favorites only change interaction is proposed.

TidalPromptLibrary.onQueryChange (required)
(value: string) => void

Callback invoked when the query change interaction is proposed.

TidalPromptLibrary.onSelectedChange (required)
(id: string) => void

Callback invoked when the selected change interaction is proposed.

TidalPromptLibrary.onUse (required)
(prompt: TidalPromptRecord, rendered: string, event: MouseEvent<HTMLButtonElement>) => void

Callback invoked when the use interaction is proposed.

TidalPromptLibrary.onVariableChange (required)
(id: string, value: string) => void

Callback invoked when the variable change interaction is proposed.

TidalPromptLibrary.prompts (required)
ReadonlyArray<TidalPromptRecord>

Required prompts value accepted by this exported component.

TidalPromptLibrary.query (required)
string

Required query value accepted by this exported component.

TidalPromptLibrary.selectedId (required)
string | null

Required selected id value accepted by this exported component.

TidalPromptLibrary.title (required)
ReactNode

Required title value accepted by this exported component.

TidalPromptLibrary.values (required)
Readonly<Record<string, string>>

Required values value accepted by this exported component.

TidalPromptLibrary.actionProps
ActionProps | undefined

Optional action props value accepted by this exported component.

TidalPromptLibrary.description
ReactNode

Optional description value accepted by this exported component.

TidalPromptLibrary.disabled
boolean | undefined

Optional disabled value accepted by this exported component.

TidalPromptLibrary.favoriteProps
((prompt: TidalPromptRecord) => ActionProps) | undefined

Optional favorite props value accepted by this exported component.

TidalPromptLibrary.formatCount
((count: number) => ReactNodeLike) | undefined

Optional format count value accepted by this exported component.

TidalPromptLibrary.headingLevel
"h2" | "h3" | "h4" | "h5" | undefined

Optional heading level value accepted by this exported component.

TidalPromptLibrary.labels
Partial<{ search: string; category: string; all: string; saved: string; save: string; remove: string; empty: string; choose: string; preview: string; variables: string; use: string; required: string; invalid: string; }> | undefined

Optional labels value accepted by this exported component.

TidalPromptLibrary.selectProps
((prompt: TidalPromptRecord) => ActionProps) | undefined

Optional select props value accepted by this exported component.

Complete usage

Full example, stylesheet imports, API and accessibility documentation

Gotchas