Overview Button Copy button Field Input Number field Textarea Select Combobox Multiselect Date picker Date range picker Date-time picker Checkbox Radio group Position picker Switch Slider Dropzone Device controls Avatar Badge Card Collapsible Kbd Map Matrix Proportion bar Separator Stat Table Timeline Chat Playback Pagination Charts Chart theming Profile chart Time series chart Bar chart Isopleth chart TS diagram Box plot Rose chart Calendar chart Banner Toast Loader Progress Skeleton Empty state Error state Dropdown menu Tooltip Info tooltip Dialog Sheet Resizable Confirm dialog Breadcrumbs Command palette Mobile menu Navigation list Outline Scroll rail Sidebar Tabs
Position picker
Where something goes in a box: a corner, an edge, the middle. A small picture of the box, a spot at each place it can go.
Corners
The default: the four corners. The picked one is drawn as a block in its place.
<script lang="ts">
import { PositionPicker, type Position } from '@kystdata/ui';
let legend = $state<Position>('top-right');
</script>
<PositionPicker bind:value={legend} aria-label="Legend position" /> Any of the nine
Edges are drawn as bars, the middle as a dot. Pass the places that make sense and names where needed.
All nine
Corners and a band
Disabled
<PositionPicker
bind:value={title}
positions={[...CORNERS, 'top']}
labels={{ top: 'Band across the top' }}
aria-label="Title position"
/> Rules
- For where a piece goes inside something: a legend on a map, a caption on an image, a badge on a card. Not for alignment of text, which is a segmented control.
- Offer the places that make sense, not all nine. A legend goes in a corner; a band goes along an edge.
- Name a place by what it does when its position doesn’t say it: "Band across the top", not "Top".
- Put it beside the field it places, on the same row, so the two read as one setting.
- The choice applies at once. Arrow keys move between the spots as they lie.