Skip to content
Back to skills

Sort

ASecurity

Sortable column header utility with animated direction indicators. Cycles through `asc` → `desc` → `null` (unsorted). Built on Framer Motion.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 27, 2026
developmenttypescriptreactnode

Works with

  • cursor
  • cli

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add reaviz/skills --skill sort --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sort?

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

Security grade badge for Sort
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/reaviz-sort/badge)](https://www.skillsdirectory.com/skills/reaviz-sort)

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

Download with Pro
SKILL.md
# Sort

Sortable column header utility with animated direction indicators. Cycles through `asc` → `desc` → `null` (unsorted). Built on Framer Motion.

## Import

```tsx
import { Sort } from 'reablocks';
// also available
import { getNextDirection, SortDirection } from 'reablocks';
```

## Sort Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `direction` | `'asc' \| 'desc' \| null` | — | Current sort direction |
| `onSort` | `(direction: SortDirection) => void` | — | Sort change callback |
| `disabled` | `boolean` | — | Disable sorting |
| `icon` | `React.ComponentType<{ className?: string }>` | `DownArrowIcon` | Sort direction icon |
| `neutralIcon` | `React.ComponentType<{ className?: string }>` | — | Icon shown when unsorted |
| `className` | `string` | — | Container CSS classes |
| `iconClassName` | `string` | — | Direction icon CSS classes |
| `neutralIconClassName` | `string` | — | Neutral icon CSS classes |
| `theme` | `SortTheme` | — | Per-instance theme override |
| `children` | `ReactNode` | — | Column header content |

## Basic Usage

```tsx
const [direction, setDirection] = useState<SortDirection>(null);

<Sort direction={direction} onSort={setDirection}>
  Column Name
</Sort>
```

## Sort Cycle

Clicking cycles: `null` → `'asc'` → `'desc'` → `null`

The ascending icon is the default icon rotated 180°. The descending icon is the default icon as-is.

## getNextDirection Utility

```tsx
import { getNextDirection } from 'reablocks';

getNextDirection(null);        // 'asc'
getNextDirection('asc');       // 'desc'
getNextDirection('desc');      // null
getNextDirection('desc', 'asc', false); // 'asc' (canBeNull=false skips null)
```

Signature: `getNextDirection(direction?, defaultDirection='asc', canBeNull=true)`

## SortTheme Interface

```typescript
interface SortTheme {
  base: string;       // Container (cursor-pointer, flex, items-center)
  disabled: string;   // Disabled state
  hasValue: string;   // Disabled but has a direction value (cursor-not-allowed)
  icon: {
    base: string;     // Icon base (size, fill, margin)
    ascending: string; // Ascending modifier (rotate-180)
  };
}
```

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.

View all in development →

Comments

Loading comments…

Newsletter

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