ChronicStone/nuxt-ui-tools / skills/consumer/shared
nuxt-ui-tools-shared
VerifiedUse this skill for shared nuxt-ui-tools runtime usage, including responsive values and reusable remote option loaders for dashboard filters, table filters, and form fields.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 924 B |
| references/getting-started.md | markdown | 2.3 KB |
| references/overview.md | markdown | 968 B |
| references/remote-options.md | markdown | 2.6 KB |
references/remote-options.md
View on GitHub# Reusable Remote Options
`defineRemoteOptions` creates one query-backed source for dashboard filters, table option filters,
and form fields. Use it when the same list, such as users, is picked in several places. Each picker
still accepts its existing inline remote definition.
```ts
import { defineRemoteOptions } from '#ui-tools/shared'
const users = defineRemoteOptions(
{
load: ({ search, page }) =>
$api.users.list.queryOptions({
query: { search, cursor: page.cursor, limit: page.size },
}),
resolveSelected: ({ values }) =>
$api.users.byIds.queryOptions({ body: { ids: values.map(String) } }),
},
{
key: 'users',
pagination: { type: 'cursor', size: 25 },
search: { debounce: 250 },
mapPage: (result) => ({
options: result.rows.map((user) => ({ value: user.id, label: user.name })),
nextCursor: result.pageInfo.nextCursor,
}),
mapSelected: (result) => result.rows.map((user) => ({ value: user.id, label: user.name })),
},
)
```
An optional `resolveLabels({ labels })` query returns the options whose label is exactly one of
`labels`, with the response shape of `resolveSelected`. Spreadsheet imports use it to match every
distinct value of a file in one request.
The first argument supplies endpoint queries, so `mapPage` and `mapSelected` infer their response
types. The maps convert endpoint data to `{ options, nextCursor }` for cursor pagination, or
`{ options, hasMore }` for page pagination. `resolveSelected` supplies labels for values restored
from a URL or an existing form value, even when their page has not loaded.
```ts
// Dashboard filter
owner: f.remote(users, { label: 'Owner' })
// Table option filter; facet counts remain a separate table concern
filter.option('ownerId', { source: { remote: users } })
// Form select; refreshOn and creation behavior can still vary per field
{ key: 'ownerId', type: 'select', options: { mode: 'remote', loader: users } }
```
Use a stable `key` for each option mapping. The endpoint query keys must include every request
input, including workspace or tenant scope; the package adds the loader key to keep mapped option
data apart from the endpoint's raw response. The loader exposes `queryKeyFor` from `load` and
`selectedQueryKeyFor` from `resolveSelected`, so an external workspace change reloads open pages
and a locale used only by the selected lookup refreshes restored labels. Form fields follow these
loader keys automatically; `refreshOn` remains available when a field depends on another field.
Parent-specific remote tree loading continues to use the inline form source, which receives
`parent` in its request.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |