Skip to content

SortButton

Opens a popover allowing the user to change current list sort field & order.

Used in a List Context (e.g. as a descendant of <List>) if there is no other sort control.

import { SortButton } from '@/components/admin';
const PostList = () => (
<List render={({ data }) => (
<div>
<SortButton fields={["title", "published_at"]} />
<ul>
{data..map(post => (
<li key={post.id}>{post.title}</li>
))}
</ul>
</div>
)}>
)
<SortButton fields={["title", "published_at"]} />

This button lets users pick the sort field, then the sort direction (ASC/DESC).

PropRequiredTypeDefaultDescription
fieldsRequiredstring[]-Whitelist of sortable field names
labelOptionalstringra.action.sorti18n key
iconOptionalReactNodeSort iconCustom icon

Additional props are passed to the underlying <button> element (e.g., className).