UI components · Composed · new in 0.7
SpCollapse · SpCollapseItem
Live
Drawn here with the Reflex version, sp_collapse · sp_collapse_item, on the ground you pick:
Code
The same example in each framework; pick one once and every example on the site follows it.
import { SpCollapse, SpCollapseItem } from '@silverpoint/react/ui/collapse';
<SpCollapse accordion> {/* native exclusive <details name> */}
<SpCollapseItem title="What is silverpoint?" defaultOpen>
<p>A fine silver line on a prepared ground.</p>
</SpCollapseItem>
<SpCollapseItem title="And cyanotype?">
<p>A white line on Prussian blue; tone is its weight.</p>
</SpCollapseItem>
</SpCollapse><script setup lang="ts">
import { SpCollapse, SpCollapseItem } from '@silverpoint/vue/ui/collapse';
</script>
<template>
<SpCollapse accordion>
<SpCollapseItem title="What is silverpoint?" default-open>
<p>A fine silver line on a prepared ground.</p>
</SpCollapseItem>
<SpCollapseItem title="And cyanotype?">
<p>A white line on Prussian blue; tone is its weight.</p>
</SpCollapseItem>
</SpCollapse>
</template>import { Component } from '@angular/core';
import { SpCollapse, SpCollapseItem } from '@silverpoint/angular/ui/collapse';
@Component({
selector: 'app-faq',
imports: [SpCollapse, SpCollapseItem],
template: `
<sp-collapse [accordion]="true">
<sp-collapse-item title="What is silverpoint?" [defaultOpen]="true">
<p>A fine silver line on a prepared ground.</p>
</sp-collapse-item>
<sp-collapse-item title="And cyanotype?">
<p>A white line on Prussian blue; tone is its weight.</p>
</sp-collapse-item>
</sp-collapse>
`,
})
export class Faq {}sp_collapse(
sp_collapse_item("What is silverpoint?", rx.el.p("A fine silver line…"), open=True),
sp_collapse_item("And cyanotype?", rx.el.p("A white line on Prussian blue…")),
accordion=True, # native exclusive <details name>
)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 { SpCollapse, SpCollapseItem } from '@silverpoint/react/ui/collapse'; |
| Vue | import { SpCollapse, SpCollapseItem } from '@silverpoint/vue/ui/collapse'; |
| Angular | import { SpCollapse, SpCollapseItem } from '@silverpoint/angular/ui/collapse'; · sp-collapse · sp-collapse-item |
| Reflex | from reflex_silverpoint_react import sp_collapse, sp_collapse_item |
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 | |
|---|---|---|---|---|
| Items | <SpCollapseItem> children | default slot | projected sp-collapse-item | sp_collapse(*items) |
| Item open | open + onToggle(open), or defaultOpen | v-model:open, @toggle | [(open)], (toggle) | open= |
Props
SpCollapse
| React / Angular | Vue | Type | Description |
|---|---|---|---|
accordion | accordion | boolean | One item open at a time, natively (<details name>). Default false. |
bordered | bordered | boolean | Default true. |
SpCollapseItem
| React / Angular | Vue | Type | Description |
|---|---|---|---|
title required | title | string | — |
disabled | disabled | boolean | — |
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. |