popover.picker
Choices that open from a button, one of which is picked: a sort order, a category. Pass multiple when any number can be picked, like tags; it then stays open while picking
Read https://www.prongs.dev/docs/intents/popover/picker.md and tell me whether popover.picker fits what I am building.Popover intents
Example
<Popover intent="popover.picker" label="Sort by" trigger={<Action intent="choice.open">Sort: {sort}</Action>}
options={[{ value: 'Newest' }, { value: 'Oldest' }]} value={sort} onChange={setSort} />Connections
Choosing between neighbours
If it is
Use
Choices that open from a button, one of which is picked: a sort order, a category. Pass multiple when any number can be picked, like tags; it then stays open while picking
popover.pickerCommands that do something
popover.menuA few options that fit on the page
choice.optionThe button that opens it
choice.openChoosing a value for a setting
rather thanpopover.menupopover.picker
For registry authors
Starter intents. These are the intents prongs add puts in your registry, shown in this site’s theme. Yours are your own registry.ts: rename, restyle and add to them, and see them with prongs add gallery.
What this intent is built from and its entry in components/prongs/registry.ts. You only need this to change how it looks or to add an intent like it.
How popover.picker resolves, and its definition
Each layer adds to the one before it; a later class wins over an earlier one that sets the same thing.
surface.floatingFloats next to the element that opened it, flipping to stay on screen. Hidden while closed, whatever display the intent sets
surface-overlay m-1 inset-auto rounded-lg border border-surface-border shadow-lg [position-area:bottom_span-right] [position-try-fallbacks:flip-block,flip-inline] origin-top-left data-[align=end]:origin-top-right data-[align=end]:[position-area:bottom_span-left] transition-[opacity,scale,display,overlay] transition-discrete duration-150 ease-out [&:not(:popover-open)]:hidden [&:not(:popover-open)]:scale-95 [&:not(:popover-open)]:opacity-0 starting:[&:popover-open]:scale-95 starting:[&:popover-open]:opacity-0 motion-reduce:transition-none
arrange.rowsIts buttons and links become full-width rows, whatever their own look, keeping a danger colour; a pressed or selected one is filled and ticked
flex flex-col [&_:is(a,button)]:flex [&_:is(a,button)]:w-full [&_:is(a,button)]:items-center [&_:is(a,button)]:justify-start [&_:is(a,button)]:gap-2.5 [&_:is(a,button)]:text-left [&_:is(a,button)]:rounded-md [&_:is(a,button)]:border-0 [&_:is(a,button)]:bg-transparent [&_:is(a,button)]:px-3 [&_:is(a,button)]:py-1.5 [&_:is(a,button)]:font-normal [&_:is(a,button)]:text-[var(--row-fg,var(--foreground))] [&_:is(a,button)]:no-underline [&_:is(a,button):hover]:no-underline [&_:is(a,button):hover]:bg-surface-hover [&_:is(a,button):focus-visible]:bg-surface-hover [&_button[aria-pressed=true]]:bg-surface-active [&_button[aria-pressed=true]]:font-medium [&_button[aria-pressed=true]]:text-foreground [&_button[aria-pressed=true]]:after:ml-auto [&_button[aria-pressed=true]]:after:content-["✓"] [&_button[aria-selected=true]]:bg-surface-active [&_button[aria-selected=true]]:font-medium [&_button[aria-selected=true]]:text-foreground [&_button[aria-selected=true]]:after:ml-auto [&_button[aria-selected=true]]:after:content-["✓"]
popover.pickerChoices that open from a button, one of which is picked: a sort order, a category. Pass multiple when any number can be picked, like tags; it then stays open while picking
max-h-80 min-w-56 gap-0.5 overflow-y-auto p-1
surface-overlay m-1 inset-auto rounded-lg border border-surface-border shadow-lg [position-area:bottom_span-right] [position-try-fallbacks:flip-block,flip-inline] origin-top-left data-[align=end]:origin-top-right data-[align=end]:[position-area:bottom_span-left] transition-[opacity,scale,display,overlay] transition-discrete duration-150 ease-out [&:not(:popover-open)]:hidden [&:not(:popover-open)]:scale-95 [&:not(:popover-open)]:opacity-0 starting:[&:popover-open]:scale-95 starting:[&:popover-open]:opacity-0 motion-reduce:transition-none flex flex-col [&_:is(a,button)]:flex [&_:is(a,button)]:w-full [&_:is(a,button)]:items-center [&_:is(a,button)]:justify-start [&_:is(a,button)]:gap-2.5 [&_:is(a,button)]:text-left [&_:is(a,button)]:rounded-md [&_:is(a,button)]:border-0 [&_:is(a,button)]:bg-transparent [&_:is(a,button)]:px-3 [&_:is(a,button)]:py-1.5 [&_:is(a,button)]:font-normal [&_:is(a,button)]:text-[var(--row-fg,var(--foreground))] [&_:is(a,button)]:no-underline [&_:is(a,button):hover]:no-underline [&_:is(a,button):hover]:bg-surface-hover [&_:is(a,button):focus-visible]:bg-surface-hover [&_button[aria-pressed=true]]:bg-surface-active [&_button[aria-pressed=true]]:font-medium [&_button[aria-pressed=true]]:text-foreground [&_button[aria-pressed=true]]:after:ml-auto [&_button[aria-pressed=true]]:after:content-["✓"] [&_button[aria-selected=true]]:bg-surface-active [&_button[aria-selected=true]]:font-medium [&_button[aria-selected=true]]:text-foreground [&_button[aria-selected=true]]:after:ml-auto [&_button[aria-selected=true]]:after:content-["✓"] max-h-80 min-w-56 gap-0.5 overflow-y-auto p-1
{ selection: 'one' }'popover.picker': {
kind: 'semantic',
description: 'Choices that open from a button, one of which is picked: a sort order, a category. Pass multiple when any number can be picked, like tags; it then stays open while picking',
refs: ['surface.floating', 'arrange.rows'],
binding: {
classes: 'max-h-80 min-w-56 gap-0.5 overflow-y-auto p-1',
behavior: { selection: 'one' },
},
notFor: [
{ context: 'commands that do something', instead: 'popover.menu' },
{
context: 'a few options that fit on the page',
instead: 'choice.option',
},
{ context: 'the button that opens it', instead: 'choice.open' },
],
},