Snippet

Loading...

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/snippet

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components

Anatomy

import {
  Snippet,
  SnippetTab,
  SnippetTabPanel,
  SnippetTabPanels,
  SnippetTabsList,
} from "@/components/ui/snippet"
const commands = [
  { id: "npm", label: "NPM", command: "npm install react-aria-components" },
  { id: "pnpm", label: "PNPM", command: "pnpm add react-aria-components" },
  { id: "yarn", label: "Yarn", command: "yarn add react-aria-components" },
  { id: "bun", label: "Bun", command: "bun add react-aria-components" },
]

<Snippet>
  <SnippetTabsList items={commands}>
    {(cmd) => <SnippetTab key={cmd.id}>{cmd.label}</SnippetTab>}
  </SnippetTabsList>
  <SnippetTabPanels items={commands}>
    {(cmd) => <SnippetTabPanel id={cmd.id}>{cmd.command}</SnippetTabPanel>}
  </SnippetTabPanels>
</Snippet>

Component API

Snippet

Snippet extends the React Aria Components <Tabs> component.

classNamestring

SnippetTab

SnippetTab extends the Intent UI <Tab> component.

classNamestring

SnippetTabPanel

SnippetTabPanel extends the React Aria Components <TabPanel> component.

classNamestring

SnippetTabPanels

SnippetTabPanels extends the Intent UI <TabPanels> component.

classNamestring

SnippetTabsList

SnippetTabsList extends the Intent UI <TabList> component.

classNamestring

See the React Aria for the full API reference.

Design