Skip to content
Eskais UI

Git

Repository Select

A select for one git repository out of several: the trigger shows the name, each option its path, the branch checked out and its state (uncommitted, ahead, behind, no remote, up to date). On UI SDK Select, so keyboard, typeahead and agents work as in any select.

Example

Installation

npx shadcn@latest add @eskais/repository-select

Usage

Import
import { RepositorySelect, repositorySelectLabels } from "@/components/ui/repository-select"

Use it to pick one git repository out of several in a workspace: each option shows the path, the branch checked out and whether it has uncommitted files, is ahead or behind its upstream, or has no remote. Put it in CommitHistory's headerStart with size="sm", or in a Field with a FieldLabel.

API reference

RepositorySelect

PropTypeDefault
valueThe chosen repository's `value`.string | null–
defaultValuestring | null–
onValueChange(value: string | null, details: ChangeDetails<SelectValueChangeReason>) => void–
openboolean–
defaultOpenboolean–
onOpenChangeSelectProps<string>["onOpenChange"]–
disabledboolean–
namestring–
repositoriesrequiredreadonly Repository[]–
aria-labelNames the trigger when no `FieldLabel` does.string–
size`sm` for a header or toolbar, like CommitHistory's `headerStart`.SelectSize–
labelsPartial<RepositorySelectLabels>–
triggerPropsOmit<SelectTriggerProps, "children">–
contentClassNamestring–

Other exports

repositorySelectLabelstype Repositorytype RepositorySelectLabelstype RepositorySelectProps

Accessibility

  • UI SDK's select: arrows, Home/End and typeahead by name; Enter or Space chooses.
  • Each state is a word on a badge ("5 uncommitted", "No remote"), never colour alone.

Agent actions

Agents read the repositories as the select's options and choose one with setValue, by value or name.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.