Skip to content
Back to skills

2944 Ui Components 32ca2838

ASecurity

<!-- CUSTOMIZE: Update to match your component library (shadcn/ui, Radix, your own packages, etc.)

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
developmenttypescriptgotesting

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2944-ui-components_32ca2838 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2944 Ui Components 32ca2838?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2944 Ui Components 32ca2838
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2944-ui-components-32ca2838/badge)](https://www.skillsdirectory.com/skills/tools-only-2944-ui-components-32ca2838)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
paths:
  - "**/_components/**/*.tsx"
  - "**/components/**/*.tsx"
---

# UI Components & JSX Patterns

## Component Library

<!-- CUSTOMIZE: Update to match your component library (shadcn/ui, Radix, your own packages, etc.)

All reusable UI lives in your shared component library. Building custom components when the library
already has the equivalent creates double maintenance and visual inconsistency.

### Import Pattern

```typescript
import { Button } from '@/components/ui/button';
import { Card } from '@/components/ui/card';
import { cn } from '@/lib/utils';
```
-->

Check your component library before building custom UI. Common components to look for:

| Category | Components |
|----------|-----------|
| Actions | Button, IconButton, Link |
| Layout | Card, Page, PageHeader, PageBody |
| Feedback | Dialog, AlertDialog, Toast |
| Forms | Input, Textarea, Select, Checkbox |
| Data | DataTable, List, EmptyState |
| Navigation | Tabs, Breadcrumbs, DropdownMenu |
| Overlays | Sheet, Popover, Tooltip |

## JSX Patterns

### Class Names — Use `cn` for Tailwind Merging

Without `cn`, conflicting Tailwind classes produce unpredictable results. Use `cn` (from `clsx` + `tailwind-merge`) to resolve conflicts deterministically:

```typescript
import { cn } from '@/lib/utils'; // or wherever your cn utility lives

// Merges Tailwind classes correctly, resolves conflicts
<div className={cn('base-class', { 'text-lg': isLarge }, className)} />
```

### Conditional Rendering

```tsx
// Ternary for simple cases
{isLoading ? <Spinner /> : <Content />}

// Early return for complex cases
if (!data) return <EmptyState />;
return <DataView data={data} />;
```

### Toasts

```typescript
import { toast } from 'sonner'; // or your toast library

toast.promise(myAction(data), {
  loading: 'Creating...',
  success: 'Created!',
  error: 'Failed to create',
});
```

## Tailwind Styling

Use theme classes instead of fixed colors for dark mode compatibility:

| Avoid | Use Instead |
|-------|------------|
| `bg-gray-500` | `bg-muted` |
| `text-gray-700` | `text-muted-foreground` |
| `bg-white` | `bg-background` |
| `text-black` | `text-foreground` |
| `bg-blue-500` | `bg-primary` |
| `text-white` on primary | `text-primary-foreground` |
| `border-gray-200` | `border-border` |

## Testing Attributes

Add `data-test` to interactive elements:

```tsx
<button data-test="submit-button">Submit</button>
<form data-test="signup-form">{/* ... */}</form>
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.