Documentation
¶
Overview ¶
Package ui holds the Crest components admin views are made of, for custom admin pages. Use them inside a panel: they rely on its stylesheet, icon sprite, and Alpine components.
In a .crest file, import the package and use qualified tags:
<ui.Card Title="Revenue"><ui.Stat Label="Today" Value={v.Today} /></ui.Card>
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct {
Label string
Href string
Type string
Variant string
Icon string
Small bool
Disabled bool
}
Button is a button, or a link styled as one when Href is set. Variant is "", "primary", "danger", or "dashed"; Icon names a sprite symbol, such as "plus".
type DataRow ¶
type DataRow struct {
Label, Value string
}
DataRow is one labeled value of a chart's data table, which screen readers and the "Show data" disclosure read.
type Dialog ¶
Dialog is a modal opened by its trigger button. Children are the body; Footer holds its buttons, and any button with x-on:click="hide" closes it.
type EmptyState ¶
EmptyState fills a card that has nothing to show.
func (EmptyState) RenderSlots ¶
func (e EmptyState) RenderSlots(crestTrack *slot.Track) slot.Rendered
type Field ¶
type Field struct {
Label string
For string
Help string
Error string
Required bool
Children crest.Component
}
Field is a labeled form control. Children are the control itself; Error and Help are shown under it.
type LegendItem ¶
type LegendItem struct {
LegendItem is one series of a partition chart. Class picks its color, such as "series-1" or "tone-warning".
type Pagination ¶
Pagination is a pager with previous and next links.
func (Pagination) RenderSlots ¶
func (p Pagination) RenderSlots(crestTrack *slot.Track) slot.Rendered
type Stat ¶
Stat is a labeled figure, such as a dashboard metric. Delta is shown with Tone, such as "+4.2%" in success.
type Table ¶
type Table struct {
Columns []Column
Empty string
EmptyIcon string
Rows int
Children crest.Component
}
Table is a data table in a card. Children are the <tr> rows.
type Widget ¶
type Widget struct {
Data WidgetData
}
Widget renders one dashboard widget: a figure, a chart, or a table, in a card. Fill Data with sight.WidgetOf on a custom page.
type WidgetCell ¶
WidgetCell is one cell of a table widget, linked when Href is set.
type WidgetData ¶
type WidgetData struct {
Key string
Kind string
Title string
Note string
Badge string
Width int
Href string
LinkLabel string
Value string
Delta string
DeltaTone string
DeltaIcon string
Compare string
Chart crest.Component
Legend []LegendItem
Columns []Column
Rows []WidgetRow
Data []DataRow
Empty string
Error string
}
WidgetData is what a Widget shows. Kind is value, trend, partition, or table; Error replaces the body when the widget failed to load.
type WidgetRow ¶
type WidgetRow struct {
Cells []WidgetCell
}
WidgetRow is one row of a table widget.