UI components · Overlays · new in 0.7
SpSelect
A single choice with typeahead: the chosen option ticked, the highlighted one heightened. Group: Overlays · new in silverpoint 0.7, in React, Vue, Angular and Reflex (sp_select).
Live
Drawn here with the Reflex version, sp_select, on the ground you pick:
Code
The same example in each framework; pick one once and every example on the site follows it.
import { useState } from 'react';
import { SpSelect } from '@silverpoint/react/ui/select';
export function Region() {
const [region, setRegion] = useState<string | null>('North');
// items: strings, or { key, label, disabled }; onChange receives the key
return <SpSelect items={['North', 'East', 'South', 'West']} label="Region" value={region} onChange={setRegion} />;
}<script setup lang="ts">
import { ref } from 'vue';
import { SpSelect } from '@silverpoint/vue/ui/select';
const region = ref<string | null>('North');
</script>
<template>
<SpSelect v-model="region" :items="['North', 'East', 'South', 'West']" label="Region" />
</template>import { Component, signal } from '@angular/core';
import { SpSelect } from '@silverpoint/angular/ui/select';
@Component({
selector: 'app-region',
imports: [SpSelect],
template: `<sp-select [(value)]="region" [items]="regions" label="Region" />`,
})
export class Region {
protected readonly regions = ['North', 'East', 'South', 'West'];
protected readonly region = signal<string | null>('North');
}sp_select(
["North", "East", "South", "West"], # or [{"key", "label", "disabled"}]
value=State.region,
on_change=State.set_region, # receives the value
label="Region",
)Import
Import @silverpoint/grounds/ui.css once, beside styles.css; Reflex adds it for you. Every adapter also exports it from the ui barrel.
| Framework | Import |
|---|---|
| React | import { SpSelect } from '@silverpoint/react/ui/select'; |
| Vue | import { SpSelect } from '@silverpoint/vue/ui/select'; |
| Angular | import { SpSelect } from '@silverpoint/angular/ui/select'; · sp-select |
| Reflex | from reflex_silverpoint_react import sp_select |
Events, values and slots
Each framework's own way. A change carries the new value itself (a key, a page, a number, a bool), never a DOM event.
| React | Vue | Angular | Reflex | |
|---|---|---|---|---|
| Value | value + onChange(key), or defaultValue | v-model | [(value)], ngModel, formControl | value + on_change |
| Open state | open + onOpenChange, or defaultOpen | v-model:open, or default-open | [(open)], or [defaultOpen] | open + on_open_change, or default_open |
Props
| React / Angular | Vue | Type | Description |
|---|---|---|---|
items required | items | readonly (string | UiItem)[] | A string is its own key and label. |
placeholder | placeholder | string | Default 'Select…'. |
label required | label | string | Accessible name of the combobox. |
disabled | disabled | boolean | Not focusable and not submitted. |
required | required | boolean | Sets aria-required on the combobox. |
name | name | string | Submits the key under this name, from a hidden input. |
width | width | string | CSS length. Default '180px' (from ui.css). |
In Reflex the names are snake_case; the Reflex column of Composed components shows the builder's arguments.
Common props
Every UI component also takes these, falling back to the dashboard it sits in, then to the provider. In Reflex they read silverpoint_provider too; only sp_trigger does not: pass them to it.
| React / Angular | Vue | Reflex | Type | Description |
|---|---|---|---|---|
id | id | id | str | The frame variant and every related id derive from it. |
ground | ground | ground | Literal['silverpoint', 'cyanotype'] | str | dict[str, Any] | Style ground: "silverpoint" or "cyanotype", or a ground object. Defaults to the dashboard's, then the provider's, or silverpoint. |
substrate | substrate | substrate | Literal['cream', 'green', 'blue', 'ochre', 'prussian'] | Prepared substrate within the ground. |
mode | mode | mode | Literal['ink', 'precision'] | ink by default; precision disables inking. |
seed | seed | seed | str | int | Seed of the frame's hand; overrides id for the frame variant only. |
size | size | size | Literal['sm', 'md', 'lg'] | Control size: sm, md (default) or lg. |
palette | palette | palette | dict[str, str] | Colours over the ground's (set with palette=), merged over the dashboard's and the provider's. |
className | class-name | class_name | str | Added to the component's root element, after its own classes. |
palette | palette | palette | Palette | Colours over the ground's, merged over the dashboard's and the provider's. |
Report it
Found something wrong with SpSelect? Open an issue on GitHub — the form comes pre-filled with the component and the version.