Sortable column header utility with animated direction indicators. Cycles through `asc` → `desc` → `null` (unsorted). Built on Framer Motion.
Scanned 5/27/2026
Install via CLI
openskills install reaviz/skills# 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)
};
}
```
No comments yet. Be the first to comment!
Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.
SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.
Python backend development expertise for FastAPI, security patterns, database operations, Upstash integrations, and code quality. Use when: (1) Building REST APIs with FastAPI, (2) Implementing JWT/OAuth2 authentication, (3) Setting up SQLAlchemy/async databases, (4) Integrating Redis/Upstash caching, (5) Refactoring AI-generated Python code (deslopification), (6) Designing API patterns, or (7) Optimizing backend performance.
Drive the full internationalization journey for a project — detect the stack, recommend a library, set up the chosen library, wrap existing strings, and optionally connect a translation platform. Use when the user asks to add or configure i18n, internationalization, localization, multi-language support, or translations — including when they explicitly mention LinguiJS, Lingui, next-intl, "wrap strings", "find hardcoded text", "make my app translatable", or "set up translations". Triggers on g...
PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.