UI components · Overlays · new in 0.7
SpPopover
Anchored content on a card frame, placed by the core on the Popover API; Escape or a click outside closes it. Group: Overlays · new in silverpoint 0.7, in React, Vue, Angular and Reflex (sp_popover).
Live
Drawn here with the Reflex version, sp_popover, on the ground you pick:
Code
The same example in each framework; pick one once and every example on the site follows it.
import { SpPopover } from '@silverpoint/react/ui/popover';
<SpPopover title="About this chart" closable width="260px" trigger={<button type="button">Details</button>}>
<p>Anchored content, on a card frame. Escape or a click outside closes it.</p>
</SpPopover><script setup lang="ts">
import { SpPopover } from '@silverpoint/vue/ui/popover';
</script>
<template>
<SpPopover title="About this chart" closable width="260px">
<template #trigger><button type="button">Details</button></template>
<p>Anchored content, on a card frame. Escape or a click outside closes it.</p>
</SpPopover>
</template>import { Component } from '@angular/core';
import { SpTrigger } from '@silverpoint/angular/ui';
import { SpPopover } from '@silverpoint/angular/ui/popover';
@Component({
selector: 'app-about-chart',
imports: [SpPopover, SpTrigger],
template: `
<sp-popover title="About this chart" [closable]="true" width="260px">
<button type="button" spTrigger>Details</button>
<p>Anchored content, on a card frame. Escape or a click outside closes it.</p>
</sp-popover>
`,
})
export class AboutChart {}sp_popover(
rx.el.p("Anchored content, on a card frame."),
trigger=sp_trigger("Details", chevron=True),
title="About this chart",
closable=True,
width=260,
)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 { SpPopover } from '@silverpoint/react/ui/popover'; |
| Vue | import { SpPopover } from '@silverpoint/vue/ui/popover'; |
| Angular | import { SpPopover } from '@silverpoint/angular/ui/popover'; · sp-popover |
| Reflex | from reflex_silverpoint_react import sp_popover |
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 | |
|---|---|---|---|---|
| Trigger | trigger={<button …/>} | #trigger slot | a projected element with spTrigger | trigger= (a string or sp_trigger) |
| 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 |
|---|---|---|---|
title | title | string | A heading that names the popover. |
label | label | string | Accessible name without a title. |
side | side | 'top' | 'end' | 'bottom' | 'start' | Default 'bottom'. |
align | align | 'start' | 'center' | 'end' | Default 'center'. |
offset | offset | number | Default 6. |
closable | closable | boolean | Default false. |
closeLabel | close-label | string | Default 'Close'. |
width | width | string | CSS length. Default '320px' (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 SpPopover? Open an issue on GitHub — the form comes pre-filled with the component and the version.