Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

radix-ui

/radix-ui

Pomaga tworzyć dostępne dropdowny, dialogi, popovery, zakładki i tooltipy oraz systemy projektowe na komponentach Radix UI.

Repozytorium
skills ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
25.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 25.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Pomaga tworzyć dostępne dropdowny, dialogi, popovery, zakładki i tooltipy oraz systemy projektowe na komponentach Radix UI.

Oryginalny opis (EN)

Build accessible UI primitives with Radix UI. Use when creating accessible dropdowns, dialogs, popovers, tabs, tooltips, or building a design system with unstyled, composable components.

Jak działa

  1. Overview
  2. Instructions
  3. Examples
  4. Guidelines
Sekcje z nagłówków SKILL.md, w oryginale · 155 linii, 639 słów
Podgląd SKILL.md
---
name: radix-ui
description: >-
  Build accessible UI primitives with Radix UI. Use when creating accessible
  dropdowns, dialogs, popovers, tabs, tooltips, or building a design system
  with unstyled, composable components.
license: Apache-2.0
compatibility: 'React 16.8+ (React 19 and RSC supported); Node.js 18+ for npm'
metadata:
  author: terminal-skills
  version: 1.1.0
  category: development
  repository: https://github.com/radix-ui/primitives
  tags: "radix-ui, accessibility, components, react, primitives"
---

# Radix UI

## Overview

Radix UI provides unstyled, accessible React primitives — dropdowns, dialogs, popovers, tabs, accordions, and more. Each component handles keyboard navigation, focus management, screen reader support, and ARIA attributes. You add your own styling. Foundation of shadcn/ui. Install the unified `radix-ui` package (recommended, tree-shakeable) or individual `@radix-ui/react-*` packages; keep all Radix packages on matching versions to avoid duplicated dependencies.

## Instructions

### Step 0: Install and import

```bash
npm install radix-ui
```

```tsx
import { Dialog, DropdownMenu, Tabs, Tooltip } from 'radix-ui'   // unified package
// or per primitive: import { Dialog } from 'radix-ui/dialog'
// older style, still supported: import * as Dialog from '@radix-ui/react-dialog'
```

The examples below use `import * as` from the individual packages; with the unified package the same `Dialog.Root`, `Dialog.Trigger` names apply.

### Step 1: Dialog

```tsx
import * as Dialog from '@radix-ui/react-dialog'

function ConfirmDialog({ trigger, title, description, onConfirm }) {
  return (
    <Dialog.Root>
      <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>
      <Dialog.Portal>
        <Dialog.Overlay className="fixed inset-0 bg-black/50 animate-in fade-in" />
        <Dialog.Content className="fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white rounded-lg p-6 w-[90vw] max-w-md shadow-xl animate-in fade-in zoom-in-95">
          <Dialog.Title className="text-lg font-semibold">{title}</Dialog.Title>
          <Dialog.Description className="text-sm text-gray-500 mt-2">
            {description}
          </Dialog.Description>
          <div className="flex justify-end gap-2 mt-6">
            <Dialog.Close asChild>
              <button className="px-4 py-2 rounded border">Cancel</button>
            </Dialog.Close>
            <button onClick={onConfirm} className="px-4 py-2 rounded bg-red-500 text-white">
              Confirm
            </button>
          </div>
          <Dialog.Close asChild>
            <button className="absolute top-4 right-4" aria-label="Close">✕</button>
          </Dialog.Close>
        </Dialog.Content>
      </Dialog.Portal>
    </Dialog.Root>
  )
}
```

### Step 2: Dropdown Menu

```tsx
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'

function UserMenu({ user }) {
  return (
    <DropdownMenu.Root>
      <DropdownMenu.Trigger asChild>
        <button className="flex items-center gap-2">
          <img src={user.avatar} className="w-8 h-8 rounded-full" alt="" />
          {user.name}
        </button>
      </DropdownMenu.Trigger>
      <DropdownMenu.Portal>
        <DropdownMenu.Content className="bg-white rounded-lg shadow-lg p-1 min-w-[180px]" sideOffset={5}>
          <DropdownMenu.Item className="px-3 py-2 rounded cursor-pointer hover:bg-gray-100">
            Profile
          </DropdownMenu.Item>
          <DropdownMenu.Item className="px-3 py-2 rounded cursor-pointer hover:bg-gray-100">
            Settings
          </DropdownMenu.Item>
          <DropdownMenu.Separator className="h-px bg-gray-200 my-1" />
          <DropdownMenu.Item className="px-3 py-2 rounded cursor-pointer hover:bg-red-50 text-red-600">
            Sign out
          </DropdownMenu.Item>
        </DropdownMenu.Content>
      </DropdownMenu.Portal>
    </DropdownMenu.Root>
  )
}
```

Every `Dialog.Content` needs a `Dialog.Title` for screen readers. Wrap it in `VisuallyHidden` if the design has no visible title; if you omit `Dialog.Description`, pass `aria-describedby={undefined}` to `Dialog.Content` to silence the warning. Use `Dialog.Close asChild` for buttons that close it.

### Step 3: Tabs

```tsx
import * as Tabs from '@radix-ui/react-tabs'

<Tabs.Root defaultValue="overview">
  <Tabs.List className="flex border-b">
    <Tabs.Trigger value="overview" className="px-4 py-2 data-[state=active]:border-b-2 data-[state=active]:border-blue-500">
      Overview
    </Tabs.Trigger>
    <Tabs.Trigger value="analytics" className="px-4 py-2 data-[state=active]:border-b-2 data-[state=active]:border-blue-500">
      Analytics
    </Tabs.Trigger>
  </Tabs.List>
  <Tabs.Content value="overview"><OverviewPanel /></Tabs.Content>
  <Tabs.Content value="analytics"><AnalyticsPanel /></Tabs.Content>
</Tabs.Root>
```

### Step 4: Tooltip

```tsx
import * as Tooltip from '@radix-ui/react-tooltip'

<Tooltip.Provider delayDuration={300}>
  <Tooltip.Root>
    <Tooltip.Trigger asChild><button aria-label="Archive">🗄</button></Tooltip.Trigger>
    <Tooltip.Portal>
      <Tooltip.Content className="rounded bg-gray-900 px-2 py-1 text-xs text-white" sideOffset={4}>
        Archive project
        <Tooltip.Arrow className="fill-gray-900" />
      </Tooltip.Content>
    </Tooltip.Portal>
  </Tooltip.Root>
</Tooltip.Provider>
```

`Tooltip.Provider` is required (put it once near the app root); the default delay is 700 ms.

## Examples

### Example 1: Confirm-delete dialog

Request: "Add a confirmation dialog before deleting an invoice."

Use `ConfirmDialog` from Step 1 with `trigger={<button>Delete invoice</button>}` and `onConfirm={() => deleteInvoice(invoice.id)}`. Result: focus moves into the dialog, Tab stays inside it, Escape closes it and returns focus to the Delete button.

### Example 2: Account menu with keyboard navigation

Request: "Make a user menu in the header that works with the keyboard."

Use `UserMenu` from Step 2 with `onSelect={() => signOut()}` on the Sign out item. Result: Enter or Space opens the menu, arrow keys move between items, typing "S" jumps to Settings, Escape closes it.

## Guidelines

- Radix is unstyled — bring your own CSS/Tailwind. For pre-styled, use shadcn/ui.
- `asChild` merges Radix behavior onto your custom elements (no extra DOM wrappers).
- `data-[state=active]` and `data-[state=open]` for styling based on component state.
- In Next.js App Router, Radix components need `'use client'` in the file that renders interactive parts.
- Use `onSelect` (not `onClick`) on menu items; call `event.preventDefault()` in it to keep the menu open.
- Radix Themes is a separate, pre-styled library (`@radix-ui/themes`), not needed for primitives.
- All components handle keyboard (Escape, Arrow keys, Enter) and screen readers automatically.
Pliki w paczce (2)
  • SKILL.md 7 KB
  • _scores.json 3 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · TerminalSkills/skills100Apache-2.0
taianh20102011/skill-for-ai100MIT
LineLuLan/line-harness100MIT
aehrc/pathling100MIT
claude-dev-suite/claude-dev-suite100MIT

Migawka bazy z 13.11.2026 · wersja paczki 2f8380d7ab6d (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 3 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100shadcn-ui-radix-primitives
    Składa dostępne, nieostylowane komponenty UI z prymitywów Radix UI i wzorców Tailwind używanych w shadcn/ui.
  • 100ui-components
    Dostarcza wzorce bibliotek komponentów UI z shadcn/ui i Radix Primitives: dostępne komponenty, dostosowywanie shadcn, bezstylowe prymitywy Radix i fundamenty systemu projektowego.
  • 100radix-ui-design-system
    Dostarcza wzorce Radix UI do budowy dostępnych systemów projektowych z headless components, motywami i architekturą compound components.
  • 100react-components
    Projektuje wielokrotnego użytku komponenty React, takie jak przyciski, modale, zakładki czy dropdowny, oparte na shadcn i Radix.
  • 95building-compound-components
    Tworzy komponenty złożone bez stylów, oddzielając logikę biznesową od wyglądu, w stylu Radix i render props.
  • 100base-ui-migrator
    Migruje kod React UI do Base UI (@base-ui/react), zastępując własne modale, dropdowny, popovery i komponenty Radix UI, Headless UI i Reach UI, z katalogiem 37 komponentów.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.