Magoo Component UI logo Magoo Component UI
← Catalog

Sort and View

sort-and-view molecule experimental

A results toolbar with a count, a native sort dropdown and a grid/list view toggle.

The width preview needs a screen wider than the chosen width — use a larger device (or a desktop browser) to see the desktop and tablet layouts.

Default

128 results

List

42 products

Props

NameTypeReq
sorts array ✓
current_sort string
view enum (grid | list)
total string

Related components

How to use

The grid/list toggle is a segmented control: the root carries data-state ("grid" | "list", from the view prop) and each button's active look is pure CSS via group-data-[state=grid]: and group-data-[state=list]: variants — so the correct button is highlighted with no JavaScript and in screenshots. behavior.js only wires interaction: clicking a view button rewrites root data-state, updates aria-pressed on both buttons, and dispatches a bubbling "view:change" CustomEvent whose detail.view is "grid" or "list". The native <select> emits its own "change" event; read it directly. The portable self-init reads config from the DOM — no props object is passed.

Use cases

bannerlist-item WCAG AA SEO 20 dir: both ai-generated