Documentation
¶
Overview ¶
Package lotusui is the ikaito design language for Gio (gioui.org) apps — desktop, mobile and web from one codebase: a semantic color system, an embedded DM Sans variable font, and prop-driven components — Button, Stack, Modal, TextField, Tabs, Split — built for immediate mode.
The design decisions the package enforces: neutral grays by default, white cards floating on a tinted page, one accent color, and status colors that render as pastel background + deep ink, never saturated fill + white text.
Customization flows through ONE object: every color a component paints comes from Theme.Palette's named tokens, every corner from Theme.Radius, every gap from Theme.Space. All of it resolves at theme construction (NewTheme with options) — never per frame — so a fully custom look costs exactly as much as the default one.
Index ¶
- Constants
- Variables
- func Alert(th *Theme, o AlertProps) layout.Widget
- func AnnotatedText(th *Theme, text string, terms []GlossaryTerm, cards []*HoverCard) layout.Widget
- func Avatar(th *Theme, o AvatarProps) layout.Widget
- func AvatarGroup(th *Theme, o AvatarGroupProps, avatars ...AvatarProps) layout.Widget
- func Badge(th *Theme, text string, o BadgeProps) layout.Widget
- func Breadcrumb(th *Theme, btns []*widget.Clickable, labels ...string) layout.Widget
- func BreadcrumbEllipsis(th *Theme) layout.Widget
- func BreadcrumbLink(th *Theme, btn *widget.Clickable, label string) layout.Widget
- func BreadcrumbPage(th *Theme, label string) layout.Widget
- func BreadcrumbSep(th *Theme, icon string) layout.Widget
- func Button(th *Theme, btn *widget.Clickable, label string, o ButtonProps) layout.Widget
- func ButtonGroup(th *Theme, o ButtonGroupProps, items ...ButtonGroupItem) layout.Widget
- func Card(th *Theme, o CardProps, content layout.Widget) layout.Widget
- func ClampCorner(r int, sz image.Point) int
- func Disabled(gtx layout.Context, when bool) layout.Context
- func DropdownMenu(th *Theme, items ...layout.Widget) layout.Widget
- func DropdownMenuCheckboxItem(th *Theme, btn *widget.Clickable, label string, checked bool) layout.Widget
- func DropdownMenuCheckboxItemIcon(th *Theme, btn *widget.Clickable, icon, label string, checked bool) layout.Widget
- func DropdownMenuItem(th *Theme, btn *widget.Clickable, label string, danger bool) layout.Widget
- func DropdownMenuItemIcon(th *Theme, btn *widget.Clickable, icon, label string, danger bool) layout.Widget
- func DropdownMenuLabel(th *Theme, text string) layout.Widget
- func DropdownMenuRadioItem(th *Theme, btn *widget.Clickable, label string, selected bool) layout.Widget
- func DropdownMenuRadioItemIcon(th *Theme, btn *widget.Clickable, icon, label string, selected bool) layout.Widget
- func DropdownMenuSeparator(th *Theme) layout.Widget
- func DropdownMenuShortcutItem(th *Theme, btn *widget.Clickable, label, shortcut string, danger bool) layout.Widget
- func Field(th *Theme, o FieldProps, control layout.Widget) layout.Widget
- func FieldError(th *Theme, msg string) layout.Widget
- func Fill(gtx layout.Context, c color.NRGBA) layout.Dimensions
- func Floating(gtx layout.Context, content layout.Widget)
- func FloatingPanel(th *Theme, gtx layout.Context, content layout.Widget) layout.Dimensions
- func FullWidth(w layout.Widget) layout.Widget
- func HSpacer(w unit.Dp) layout.Widget
- func HStack(gap unit.Dp, children ...layout.Widget) layout.Widget
- func Hairline(th *Theme) layout.Widget
- func HoverRow(th *Theme, btn *widget.Clickable, active bool, content layout.Widget) layout.Widget
- func InputFrameErr(th *Theme, gtx layout.Context, invalid bool, content layout.Widget) layout.Dimensions
- func Kbd(th *Theme, key string) layout.Widget
- func LabelBody(th *Theme, txt string) material.LabelStyle
- func LabelCaption(th *Theme, txt string) material.LabelStyle
- func LabelCardTitle(th *Theme, txt string) material.LabelStyle
- func LabelHero(th *Theme, txt string) material.LabelStyle
- func LabelMeta(th *Theme, txt string) material.LabelStyle
- func LabelTitle(th *Theme, txt string) material.LabelStyle
- func LayoutPage(th *Theme, gtx layout.Context, content layout.Widget) layout.Dimensions
- func ListView(th *Theme, list *widget.List, gtx layout.Context, count int, ...) layout.Dimensions
- func OpenURL(u string) error
- func Progress(th *Theme, value float32) layout.Widget
- func RegisterIconFS(fsys fs.FS, dir string)
- func RightAligned(w layout.Widget) layout.Widget
- func SVGIcon(name string, size unit.Dp, col color.NRGBA) layout.Widget
- func SVGIconButton(th *Theme, btn *widget.Clickable, icon string, size unit.Dp, active bool) layout.Widget
- func SVGIconButtonTint(th *Theme, btn *widget.Clickable, icon string, size unit.Dp, active bool, ...) layout.Widget
- func ScreenTitle(th *Theme, text string) layout.Widget
- func Scrollable(th *Theme, list *widget.List, gtx layout.Context, content layout.Widget) layout.Dimensions
- func SectionLabel(th *Theme, text string) layout.Widget
- func Separator(th *Theme) layout.Widget
- func SeparatorVertical(th *Theme) layout.Widget
- func Show(th *Theme, gtx layout.Context, when ResponsiveBool, w layout.Widget) layout.Dimensions
- func SimpleGrid[T any](th *Theme, gtx layout.Context, items []T, p SimpleGridProps, ...) layout.Dimensions
- func Skeleton(th *Theme, w, h unit.Dp) layout.Widget
- func SkeletonCircle(th *Theme, d unit.Dp) layout.Widget
- func Sp(th *Theme, ratio float32) unit.Sp
- func Spacer(h unit.Dp) layout.Widget
- func Spinner(th *Theme, size unit.Dp) layout.Widget
- func SpinnerTint(th *Theme, size unit.Dp, col color.NRGBA) layout.Widget
- func SplitBox(th *Theme, content layout.Widget) layout.Widget
- func SplitBoxFillScroll(th *Theme, list *widget.List, maxH int, content layout.Widget) layout.Widget
- func SplitBoxScroll(th *Theme, list *widget.List, maxH int, content layout.Widget) layout.Widget
- func SplitColumnScroll(th *Theme, list *widget.List, maxH int, content layout.Widget) layout.Widget
- func SurfaceCard(th *Theme, gtx layout.Context, content layout.Widget) layout.Dimensions
- func Table(th *Theme, o TableProps, header []string, rows [][]layout.Widget) layout.Widget
- func TableText(th *Theme, o TableProps, header []string, rows [][]string) layout.Widget
- func TitleWithIcons(th *Theme, title string, icons ...layout.Widget) layout.Widget
- func TopBar(th *Theme, title string, leading layout.Widget) layout.Widget
- func VStack(gap unit.Dp, children ...layout.Widget) layout.Widget
- func VerticalHairline(th *Theme) layout.Widget
- func Wrap(gap unit.Dp, align layout.Alignment, children ...layout.Widget) layout.Widget
- type Accordion
- type AccordionItem
- type AlertDialog
- type AlertDialogProps
- type AlertProps
- type AlertVariant
- type AttachedEdges
- type AvatarBadge
- type AvatarGroupProps
- type AvatarProps
- type BadgeProps
- type BadgeVariant
- type Breakpoint
- type Breakpoints
- type ButtonGroupItem
- type ButtonGroupProps
- type ButtonProps
- type ButtonVariant
- type CardProps
- type CardVariant
- type Checkbox
- type ColorScale
- type Dialog
- type DropdownMenuSub
- type DropdownMenuTrigger
- type FieldProps
- type GlossarySeg
- type GlossaryTerm
- type Grid
- type GridItem
- type HoverCard
- type HoverCardSide
- type Input
- func (f *Input) ApplyConstraints()
- func (f *Input) Layout(th *Theme, gtx layout.Context, label, hint string) layout.Dimensions
- func (f *Input) LayoutField(th *Theme, gtx layout.Context, hint string) layout.Dimensions
- func (f *Input) LayoutSuffix(th *Theme, gtx layout.Context, label, hint, suffix string) layout.Dimensions
- type InputOTP
- type InputVariant
- type Pagination
- type Palette
- type Popover
- type PopoverAlign
- type RadioGroup
- type RadioOption
- type RadiusScale
- type ResponsiveBool
- type ResponsiveDp
- type ResponsiveInt
- type ResponsiveSize
- type Scheme
- type Select
- type SelectGroup
- type SelectOption
- type SimpleGridProps
- type Size
- type Slider
- type SpaceScale
- type Split
- type Stack
- type Switch
- type TabOption
- type TableProps
- type Tabs
- type TabsVariant
- type Textarea
- type Theme
- type ThemeOption
- func WithBreakpoints(bp Breakpoints) ThemeOption
- func WithFaces(faces []font.FontFace) ThemeOption
- func WithPageMax(max unit.Dp) ThemeOption
- func WithPalette(p Palette) ThemeOption
- func WithRadius(r RadiusScale) ThemeOption
- func WithSpace(s SpaceScale) ThemeOption
- func WithTextSize(sz unit.Sp) ThemeOption
- type Toast
- type ToastVariant
- type Toaster
- type Toggle
- type ToggleGroup
- func (g *ToggleGroup) Chosen() bool
- func (g *ToggleGroup) Clear()
- func (g *ToggleGroup) Layout(th *Theme, gtx layout.Context, size Size) layout.Dimensions
- func (g *ToggleGroup) SetValue(v string)
- func (g *ToggleGroup) SetValues(vs []string)
- func (g *ToggleGroup) Value() string
- func (g *ToggleGroup) Values() []string
- type ToggleOption
- type ToggleProps
- type Tooltip
- type TooltipSide
- type VSlide
Examples ¶
Constants ¶
const ( IconAccept = "accept" IconAdd = "add" IconArchive = "archive" IconArrowLeft = "arrow-left" IconBell = "bell" IconBuilding = "building" IconChanges = "changes" IconChevronDown = "chevron-down" IconChevronRight = "chevron-right" IconClock = "clock" IconCreditCard = "credit-card" IconDot = "dot" IconEdit = "edit" IconExpand = "expand" IconEye = "eye" IconEyeOff = "eye-off" IconFile = "file" IconInfo = "info" IconLock = "lock" IconMail = "mail" IconMessage = "message" IconMinus = "minus" IconMoreHorizontal = "more-horizontal" IconPerson = "person" IconPlus = "plus" IconRefuse = "refuse" IconRemove = "remove" IconSearch = "search" IconSettings = "settings" IconTextBold = "text-bold" IconTextItalic = "text-italic" IconTextUnderline = "text-underline" IconTrash = "trash" IconWallet = "wallet" IconWarning = "warning" )
Typed names for every icon in the manifest — a removed or misspelled icon fails at COMPILE time, not as a blank square.
const Version = "0.8.0"
Version is the lotusui release this build comes from — the same version the changelog and the docs site are organized by.
Variables ¶
var ( Gray = ColorScale{ C50: color.NRGBA{R: 0xEC, G: 0xEE, B: 0xF1, A: 0xFF}, C100: color.NRGBA{R: 0xDC, G: 0xDF, B: 0xE5, A: 0xFF}, C200: color.NRGBA{R: 0xC1, G: 0xC7, B: 0xD1, A: 0xFF}, C300: color.NRGBA{R: 0xA6, G: 0xB0, B: 0xBD, A: 0xFF}, C400: color.NRGBA{R: 0x8C, G: 0x98, B: 0xAA, A: 0xFF}, C500: color.NRGBA{R: 0x71, G: 0x80, B: 0x96, A: 0xFF}, C600: color.NRGBA{R: 0x5B, G: 0x69, B: 0x7C, A: 0xFF}, C700: color.NRGBA{R: 0x4B, G: 0x56, B: 0x66, A: 0xFF}, C800: color.NRGBA{R: 0x3B, G: 0x43, B: 0x50, A: 0xFF}, C900: color.NRGBA{R: 0x2B, G: 0x31, B: 0x3A, A: 0xFF}, } Red = ColorScale{ C50: color.NRGBA{R: 0xFB, G: 0xE3, B: 0xE3, A: 0xFF}, C100: color.NRGBA{R: 0xF8, G: 0xCE, B: 0xCE, A: 0xFF}, C200: color.NRGBA{R: 0xF4, G: 0xAA, B: 0xAA, A: 0xFF}, C300: color.NRGBA{R: 0xEF, G: 0x86, B: 0x86, A: 0xFF}, C400: color.NRGBA{R: 0xEA, G: 0x62, B: 0x62, A: 0xFF}, C500: color.NRGBA{R: 0xE5, G: 0x3E, B: 0x3E, A: 0xFF}, C600: color.NRGBA{R: 0xD0, G: 0x1C, B: 0x1C, A: 0xFF}, C700: color.NRGBA{R: 0xA9, G: 0x17, B: 0x17, A: 0xFF}, C800: color.NRGBA{R: 0x83, G: 0x12, B: 0x12, A: 0xFF}, C900: color.NRGBA{R: 0x5C, G: 0x0C, B: 0x0C, A: 0xFF}, } Orange = ColorScale{ C50: color.NRGBA{R: 0xFB, G: 0xEB, B: 0xE1, A: 0xFF}, C100: color.NRGBA{R: 0xF7, G: 0xDA, B: 0xC7, A: 0xFF}, C200: color.NRGBA{R: 0xF1, G: 0xBE, B: 0x9D, A: 0xFF}, C300: color.NRGBA{R: 0xEB, G: 0xA2, B: 0x73, A: 0xFF}, C400: color.NRGBA{R: 0xE5, G: 0x87, B: 0x49, A: 0xFF}, C500: color.NRGBA{R: 0xDD, G: 0x6B, B: 0x20, A: 0xFF}, C600: color.NRGBA{R: 0xB5, G: 0x58, B: 0x1A, A: 0xFF}, C700: color.NRGBA{R: 0x96, G: 0x48, B: 0x16, A: 0xFF}, C800: color.NRGBA{R: 0x76, G: 0x39, B: 0x11, A: 0xFF}, C900: color.NRGBA{R: 0x56, G: 0x2A, B: 0x0C, A: 0xFF}, } Yellow = ColorScale{ C50: color.NRGBA{R: 0xF9, G: 0xF2, B: 0xE3, A: 0xFF}, C100: color.NRGBA{R: 0xF5, G: 0xE7, B: 0xCB, A: 0xFF}, C200: color.NRGBA{R: 0xED, G: 0xD5, B: 0xA4, A: 0xFF}, C300: color.NRGBA{R: 0xE5, G: 0xC2, B: 0x7C, A: 0xFF}, C400: color.NRGBA{R: 0xDE, G: 0xB0, B: 0x55, A: 0xFF}, C500: color.NRGBA{R: 0xD6, G: 0x9E, B: 0x2E, A: 0xFF}, C600: color.NRGBA{R: 0xB2, G: 0x82, B: 0x23, A: 0xFF}, C700: color.NRGBA{R: 0x92, G: 0x6B, B: 0x1D, A: 0xFF}, C800: color.NRGBA{R: 0x73, G: 0x54, B: 0x17, A: 0xFF}, C900: color.NRGBA{R: 0x53, G: 0x3D, B: 0x10, A: 0xFF}, } Green = ColorScale{ C50: color.NRGBA{R: 0xE3, G: 0xF5, B: 0xEC, A: 0xFF}, C100: color.NRGBA{R: 0xCA, G: 0xED, B: 0xDA, A: 0xFF}, C200: color.NRGBA{R: 0xA1, G: 0xDE, B: 0xBE, A: 0xFF}, C300: color.NRGBA{R: 0x78, G: 0xD0, B: 0xA1, A: 0xFF}, C400: color.NRGBA{R: 0x4F, G: 0xC2, B: 0x84, A: 0xFF}, C500: color.NRGBA{R: 0x38, G: 0xA1, B: 0x69, A: 0xFF}, C600: color.NRGBA{R: 0x2F, G: 0x86, B: 0x57, A: 0xFF}, C700: color.NRGBA{R: 0x27, G: 0x70, B: 0x49, A: 0xFF}, C800: color.NRGBA{R: 0x20, G: 0x5B, B: 0x3B, A: 0xFF}, C900: color.NRGBA{R: 0x18, G: 0x45, B: 0x2D, A: 0xFF}, } Teal = ColorScale{ C50: color.NRGBA{R: 0xE2, G: 0xF5, B: 0xF5, A: 0xFF}, C100: color.NRGBA{R: 0xC7, G: 0xED, B: 0xEC, A: 0xFF}, C200: color.NRGBA{R: 0x9A, G: 0xDE, B: 0xDD, A: 0xFF}, C300: color.NRGBA{R: 0x6E, G: 0xD0, B: 0xCE, A: 0xFF}, C400: color.NRGBA{R: 0x41, G: 0xC1, B: 0xBF, A: 0xFF}, C500: color.NRGBA{R: 0x31, G: 0x97, B: 0x95, A: 0xFF}, C600: color.NRGBA{R: 0x29, G: 0x7F, B: 0x7D, A: 0xFF}, C700: color.NRGBA{R: 0x23, G: 0x6B, B: 0x6A, A: 0xFF}, C800: color.NRGBA{R: 0x1D, G: 0x58, B: 0x57, A: 0xFF}, C900: color.NRGBA{R: 0x16, G: 0x44, B: 0x44, A: 0xFF}, } Blue = ColorScale{ C50: color.NRGBA{R: 0xE3, G: 0xEE, B: 0xF8, A: 0xFF}, C100: color.NRGBA{R: 0xCC, G: 0xE0, B: 0xF3, A: 0xFF}, C200: color.NRGBA{R: 0xA5, G: 0xC9, B: 0xEA, A: 0xFF}, C300: color.NRGBA{R: 0x7E, G: 0xB1, B: 0xE0, A: 0xFF}, C400: color.NRGBA{R: 0x58, G: 0x99, B: 0xD7, A: 0xFF}, C500: color.NRGBA{R: 0x31, G: 0x82, B: 0xCE, A: 0xFF}, C600: color.NRGBA{R: 0x28, G: 0x6B, B: 0xA9, A: 0xFF}, C700: color.NRGBA{R: 0x21, G: 0x58, B: 0x8B, A: 0xFF}, C800: color.NRGBA{R: 0x1A, G: 0x45, B: 0x6E, A: 0xFF}, C900: color.NRGBA{R: 0x13, G: 0x32, B: 0x50, A: 0xFF}, } Cyan = ColorScale{ C50: color.NRGBA{R: 0xD9, G: 0xF9, B: 0xFF, A: 0xFF}, C100: color.NRGBA{R: 0xB8, G: 0xF3, B: 0xFF, A: 0xFF}, C200: color.NRGBA{R: 0x80, G: 0xEA, B: 0xFF, A: 0xFF}, C300: color.NRGBA{R: 0x48, G: 0xE1, B: 0xFF, A: 0xFF}, C400: color.NRGBA{R: 0x11, G: 0xD8, B: 0xFF, A: 0xFF}, C500: color.NRGBA{R: 0x00, G: 0xB5, B: 0xD8, A: 0xFF}, C600: color.NRGBA{R: 0x00, G: 0x97, B: 0xB4, A: 0xFF}, C700: color.NRGBA{R: 0x00, G: 0x7E, B: 0x97, A: 0xFF}, C800: color.NRGBA{R: 0x00, G: 0x66, B: 0x7A, A: 0xFF}, C900: color.NRGBA{R: 0x00, G: 0x4E, B: 0x5D, A: 0xFF}, } Purple = ColorScale{ C50: color.NRGBA{R: 0xEC, G: 0xE7, B: 0xF9, A: 0xFF}, C100: color.NRGBA{R: 0xDE, G: 0xD4, B: 0xF4, A: 0xFF}, C200: color.NRGBA{R: 0xC7, G: 0xB6, B: 0xEC, A: 0xFF}, C300: color.NRGBA{R: 0xAF, G: 0x97, B: 0xE5, A: 0xFF}, C400: color.NRGBA{R: 0x98, G: 0x79, B: 0xDD, A: 0xFF}, C500: color.NRGBA{R: 0x80, G: 0x5A, B: 0xD5, A: 0xFF}, C600: color.NRGBA{R: 0x5F, G: 0x32, B: 0xC3, A: 0xFF}, C700: color.NRGBA{R: 0x4D, G: 0x28, B: 0x9E, A: 0xFF}, C800: color.NRGBA{R: 0x3B, G: 0x1F, B: 0x7A, A: 0xFF}, C900: color.NRGBA{R: 0x29, G: 0x16, B: 0x55, A: 0xFF}, } Pink = ColorScale{ C50: color.NRGBA{R: 0xF9, G: 0xE4, B: 0xEF, A: 0xFF}, C100: color.NRGBA{R: 0xF4, G: 0xCF, B: 0xE2, A: 0xFF}, C200: color.NRGBA{R: 0xED, G: 0xAB, B: 0xCC, A: 0xFF}, C300: color.NRGBA{R: 0xE5, G: 0x87, B: 0xB7, A: 0xFF}, C400: color.NRGBA{R: 0xDD, G: 0x63, B: 0xA1, A: 0xFF}, C500: color.NRGBA{R: 0xD5, G: 0x3F, B: 0x8C, A: 0xFF}, C600: color.NRGBA{R: 0xB8, G: 0x28, B: 0x72, A: 0xFF}, C700: color.NRGBA{R: 0x97, G: 0x21, B: 0x5E, A: 0xFF}, C800: color.NRGBA{R: 0x75, G: 0x1A, B: 0x49, A: 0xFF}, C900: color.NRGBA{R: 0x54, G: 0x12, B: 0x34, A: 0xFF}, } )
The stock scales: ten familiar hues, each graded from its anchor at BUILD time — plain values, no init-time math. Use them directly (Teal.C100), as button schemes (Teal.Scheme()), or as a starting point for a Palette.
var DefaultBreakpoints = MustBreakpoints([]Breakpoint{
{Name: "base", Min: 0},
{Name: "sm", Min: 480},
{Name: "md", Min: 768},
{Name: "lg", Min: 992},
{Name: "xl", Min: 1280},
{Name: "2xl", Min: 1536},
})
DefaultBreakpoints mirrors Chakra's common scale (dp).
var DefaultDarkPalette = Palette{ Bg: rgb(0x16, 0x17, 0x1E), BgSubtle: rgb(0x1C, 0x1E, 0x27), BgMuted: rgb(0x23, 0x26, 0x31), BgEmphasized: rgb(0x2C, 0x30, 0x40), BgPanel: rgb(0x1E, 0x20, 0x29), BgInverted: rgb(0xF3, 0xF4, 0xFA), BorderSubtle: rgb(0x26, 0x29, 0x35), BorderMuted: rgb(0x2C, 0x30, 0x40), Border: rgb(0x33, 0x37, 0x48), BorderEmphasized: rgb(0x43, 0x49, 0x60), Fg: rgb(0xEC, 0xED, 0xF5), FgMuted: rgb(0xBF, 0xC2, 0xD4), FgSubtle: rgb(0x8B, 0x8F, 0xA8), FgDisabled: rgb(0x56, 0x5A, 0x70), FgInverted: rgb(0x23, 0x24, 0x2F), BrandSolid: rgb(0xE0, 0xD9, 0xFF), BrandSubtle: rgb(0x2A, 0x27, 0x45), BrandFg: rgb(0xB7, 0xA9, 0xFF), BrandEmphasized: rgb(0xC9, 0xBD, 0xF7), BrandContrast: rgb(0x2F, 0x25, 0x66), Success: rgb(0x6E, 0xD9, 0x9B), SuccessBg: rgb(0x12, 0x29, 0x1C), Warning: rgb(0xE5, 0xB4, 0x60), WarningBg: rgb(0x2E, 0x24, 0x13), Info: rgb(0x7F, 0xB1, 0xF5), InfoBg: rgb(0x14, 0x22, 0x3A), Danger: rgb(0xF0, 0x6E, 0x6E), DangerBg: rgb(0x37, 0x1A, 0x1A), DangerContrast: rgb(0x2B, 0x0A, 0x0A), Overlay: color.NRGBA{A: 150}, FocusRing: rgb(0xB7, 0xA9, 0xFF), }
DefaultDarkPalette is the built-in dark theme: the same lavender brand on a deep cool-gray canvas. Dark mode in lotusui is not a mode at all — it is a Palette like any other, applied with NewTheme(WithPalette(DefaultDarkPalette)); an app that follows the system appearance simply constructs both themes at startup and swaps the pointer. Every ladder keeps the light palette's ORDER (faint → prominent) — components never know which world they're in.
var DefaultPalette = Palette{ Bg: rgb(0xF3, 0xF4, 0xFA), BgSubtle: rgb(0xF4, 0xF5, 0xFB), BgMuted: rgb(0xE9, 0xEB, 0xF4), BgEmphasized: rgb(0xDD, 0xE0, 0xEC), BgPanel: rgb(0xFF, 0xFF, 0xFF), BgInverted: rgb(0x23, 0x24, 0x2F), BorderSubtle: rgb(0xEC, 0xEE, 0xF6), BorderMuted: rgb(0xE9, 0xEB, 0xF4), Border: rgb(0xE6, 0xE8, 0xF2), BorderEmphasized: rgb(0xD4, 0xD8, 0xE7), Fg: rgb(0x23, 0x24, 0x2F), FgMuted: rgb(0x47, 0x4A, 0x5A), FgSubtle: rgb(0x6F, 0x72, 0x88), FgDisabled: rgb(0xAF, 0xB2, 0xC6), FgInverted: rgb(0xFF, 0xFF, 0xFF), BrandSolid: rgb(0xE0, 0xD9, 0xFF), BrandSubtle: rgb(0xEC, 0xE9, 0xFC), BrandFg: rgb(0x4C, 0x3F, 0xD6), BrandEmphasized: rgb(0xC9, 0xBD, 0xF7), BrandContrast: rgb(0x2F, 0x25, 0x66), Success: rgb(0x11, 0x7A, 0x3D), SuccessBg: rgb(0xD9, 0xF3, 0xE4), Warning: rgb(0x8C, 0x5F, 0x00), WarningBg: rgb(0xFD, 0xF3, 0xDD), Info: rgb(0x2A, 0x62, 0xB5), InfoBg: rgb(0xE1, 0xEC, 0xFB), Danger: rgb(0xC8, 0x2E, 0x2E), DangerBg: rgb(0xFD, 0xEC, 0xEC), DangerContrast: rgb(0xFF, 0xFF, 0xFF), Overlay: color.NRGBA{A: 110}, FocusRing: rgb(0x4C, 0x3F, 0xD6), }
DefaultPalette is the ikaito color scheme: the white-dominant gray scale shared across ikaito desktop tools, with the soft-lavender brand accent.
var Radius = RadiusScale{SM: 6, MD: 10, LG: 12}
Radius holds the default corner-radius scale. Treat it as read-only: per-app customization goes through NewTheme(WithRadius(...)), which components read as th.Radius.
var Space = SpaceScale{XS: 4, SM: 8, MD: 16, LG: 24, XL: 32}
Space holds the default 8pt spacing scale. Treat it as read-only: per-app customization goes through NewTheme(WithSpace(...)), which components read as th.Space.
Functions ¶
func Alert ¶
func Alert(th *Theme, o AlertProps) layout.Widget
Alert is the static callout: an icon, a title, and an optional description in a bordered, tinted box. It informs — for actions use Dialog or AlertDialog.
func AnnotatedText ¶ added in v0.3.1
AnnotatedText lays out text with glossary terms in BrandFg. When cards[i] is non-nil for terms[i], that term gets a HoverCard tip (Tip as Caption). A nil card or missing index paints BrandFg only — len(cards) may differ from len(terms); never panics. Segments flow with Wrap (gap 0) so a narrow Max.X never squeezes labels into 1-character columns. Does not change HoverCard defaults (Width max 320, OpenDelay 700ms); compact UIs set Width / OpenDelay / Side on each card. Width is a max — the card hugs content so short tips stay on the trigger.
func Avatar ¶
func Avatar(th *Theme, o AvatarProps) layout.Widget
Avatar renders the circular identity mark: initials (or the person glyph) on a tinted circle, plus the status Badge when set. For the overlapping-group pattern use AvatarGroup.
func AvatarGroup ¶
func AvatarGroup(th *Theme, o AvatarGroupProps, avatars ...AvatarProps) layout.Widget
AvatarGroup overlaps avatars right-over-left, each ringed in the panel background, with an optional trailing count bubble.
func Badge ¶
func Badge(th *Theme, text string, o BadgeProps) layout.Widget
Badge renders a small rounded label — counts, statuses, health. The status doctrine holds whatever the colors: tinted pill + deep ink, never saturated fill + white text (BadgeDefault exists for schemes whose Solid/OnSolid pair honors contrast).
func Breadcrumb ¶
Breadcrumb renders the path to the current page: muted ancestor labels separated by chevrons, the LAST label in full ink as the current page. btns, when non-nil and index-aligned, makes ancestor labels clickable (poll Clicked on your side); the current page is never interactive. The composable pieces — BreadcrumbLink, BreadcrumbPage, BreadcrumbSep, BreadcrumbEllipsis — build custom trails (a dot separator, an ellipsis for collapsed depth, a dropdown item) in a Flex row; Breadcrumb is the convenience over them.
func BreadcrumbEllipsis ¶
BreadcrumbEllipsis marks collapsed depth: the more-horizontal glyph in muted ink.
func BreadcrumbLink ¶
BreadcrumbLink is one clickable ancestor: muted ink, pointer cursor. Poll btn.Clicked on your side.
func BreadcrumbPage ¶
BreadcrumbPage is the current page: full ink, medium weight, never interactive.
func BreadcrumbSep ¶
BreadcrumbSep is the between-items glyph; empty icon means the default chevron. IconDot gives the dotted trail.
func Button ¶
Button lays out one button. The MD size matches the app's button spec (8dp corners, 14sp semibold, 12/20 padding).
Example ¶
package main
import (
"gioui.org/widget"
lotusui "github.com/ikaito-com/lotusui"
)
func main() {
th := lotusui.NewTheme()
var save widget.Clickable
w := lotusui.Button(th, &save, "Save", lotusui.ButtonProps{Loading: false})
_ = w // lay out inside a frame: w(gtx)
}
Output:
func ButtonGroup ¶
func ButtonGroup(th *Theme, o ButtonGroupProps, items ...ButtonGroupItem) layout.Widget
ButtonGroup attaches its children edge-to-edge: shared borders, square inner corners, only the group's outer corners rounded. Neighbors overlap by 1dp so their borders collapse to one line.
func Card ¶
Card is the grouping surface: a rounded panel around arbitrary content — header, body and footer are composition (stack them), not slots. It honors gtx.Constraints.Min.Y: a card asked to be at least as tall as its row siblings stretches its chrome to match (content stays top-aligned), which is what makes equal-height card rows possible (see SimpleGrid's measure pass).
Content Min.Y is zeroed before the child layouts; re-assert Min.Y = Max.Y on the content if you need fill layout inside (see SplitBoxFillScroll). Max.X is reduced by 2× Pad(); Max.Y is not — children that fill Max.Y can paint under the pad unless the caller (or a Split pane helper) subtracts Pad().
func ClampCorner ¶
ClampCorner caps a corner radius at half the smaller side — past that, a rounded rect's corners grow spurs instead of staying a clean capsule. Every fixed-radius chrome that can meet an arbitrary size goes through this.
func Disabled ¶
Disabled conditionally disables gtx — a small readability helper used to gate buttons on state.
func DropdownMenu ¶
DropdownMenu lays out items as the standard menu panel: BgPanel surface, border, soft radius. Vertical edge inset is Space.XS; the gap between items is half of that so adjacent hover pills don't read as double-spaced. Rows span the full panel width (same rhythm as Select).
func DropdownMenuCheckboxItem ¶
func DropdownMenuCheckboxItem(th *Theme, btn *widget.Clickable, label string, checked bool) layout.Widget
DropdownMenuCheckboxItem is a toggleable row: a check-mark gutter, marked while checked. State lives with the caller — flip it on Clicked, immediate-mode style.
func DropdownMenuCheckboxItemIcon ¶
func DropdownMenuCheckboxItemIcon(th *Theme, btn *widget.Clickable, icon, label string, checked bool) layout.Widget
DropdownMenuCheckboxItemIcon is DropdownMenuCheckboxItem with a leading icon between the gutter and the label.
func DropdownMenuItem ¶
DropdownMenuItem is one action in a menu: a full-width interactive ROW — start-aligned label, pointer cursor, and the same hover-pill language as every other interactive row. danger marks a destructive action — danger INK on a danger-tinted hover, never a saturated fill.
func DropdownMenuItemIcon ¶
func DropdownMenuItemIcon(th *Theme, btn *widget.Clickable, icon, label string, danger bool) layout.Widget
DropdownMenuItemIcon is DropdownMenuItem with a leading icon, tinted with the row's own ink.
func DropdownMenuLabel ¶
DropdownMenuLabel is a non-interactive group heading inside a menu.
func DropdownMenuRadioItem ¶
func DropdownMenuRadioItem(th *Theme, btn *widget.Clickable, label string, selected bool) layout.Widget
DropdownMenuRadioItem is an exclusive-choice row: a dot gutter, marked on the selected row of the caller's group.
func DropdownMenuRadioItemIcon ¶
func DropdownMenuRadioItemIcon(th *Theme, btn *widget.Clickable, icon, label string, selected bool) layout.Widget
DropdownMenuRadioItemIcon is DropdownMenuRadioItem with a leading icon between the gutter and the label.
func DropdownMenuSeparator ¶
DropdownMenuSeparator is the hairline between menu groups.
func DropdownMenuShortcutItem ¶
func DropdownMenuShortcutItem(th *Theme, btn *widget.Clickable, label, shortcut string, danger bool) layout.Widget
DropdownMenuShortcutItem is DropdownMenuItem with a right-aligned keyboard hint (⌘S, ⇧⌘D…) in muted ink. The hint is display only — binding the key is the caller's.
func Field ¶
Field lays out the wrapper around control. When Error is set it replaces the helper line — one message slot, the error wins.
func FieldError ¶
FieldError is the one validation-message look: quiet, danger ink, below the field it belongs to.
func Floating ¶
Floating paints content above everything else this frame, anchored at the caller's current position.
func FloatingPanel ¶
FloatingPanel is the floating full-height rounded panel the sidebar uses — white on the tinted page, soft radius, shadow elevation.
func HStack ¶
HStack stacks children horizontally with a uniform gap — Chakra's HStack. Like Chakra's, children center on the cross axis, so a switch and its label sit on one visual line.
HStack never wraps: under a narrow Max.X, Rigid children are squeezed and labels can wrap per character. Use Wrap when chips/labels must flow to the next line at their intrinsic width.
func Hairline ¶
Hairline draws a 1dp horizontal divider spanning the available width. Use only inside a Vertical Flex — as a Rigid child of a Horizontal Flex it would greedily claim all remaining width; use VerticalHairline there instead.
func HoverRow ¶
HoverRow makes one list item interactive the app's one way: the full row is clickable, shows the pointer (hand) cursor, and fills a rounded pill in a tint one step off the wrapper card's white (Surface2) while hovered — and keeps it while active (the selected row), the same treatment as the sidebar's active pill, so every interactive row in the app reads identically. content lays out bare; this wraps it in the row's padding.
func InputFrameErr ¶
func InputFrameErr(th *Theme, gtx layout.Context, invalid bool, content layout.Widget) layout.Dimensions
InputFrameErr draws the default outline field chrome around any content — for composite fields that manage their own editor.
func Kbd ¶
Kbd renders a keyboard-key hint — a small bordered cap in muted ink: the "⌘K" beside a search field. Display only.
func LabelBody ¶
func LabelBody(th *Theme, txt string) material.LabelStyle
LabelBody is primary row/content text — 14sp regular.
func LabelCaption ¶
func LabelCaption(th *Theme, txt string) material.LabelStyle
LabelCaption is the smallest text — timestamps, fine print, 12sp.
func LabelCardTitle ¶
func LabelCardTitle(th *Theme, txt string) material.LabelStyle
LabelCardTitle is a card's own heading — 14sp semibold.
func LabelHero ¶
func LabelHero(th *Theme, txt string) material.LabelStyle
LabelHero is the one big text on a screen — a screen's H1. 20sp.
func LabelMeta ¶
func LabelMeta(th *Theme, txt string) material.LabelStyle
LabelMeta is secondary/explanatory text — 13sp.
func LabelTitle ¶
func LabelTitle(th *Theme, txt string) material.LabelStyle
LabelTitle is a section/modal/card-group title — 16sp semibold.
func LayoutPage ¶
LayoutPage centers content in a max-width column — one readable measure, generous whitespace. Reports the full available width so parent Flex layouts behave. Cap is th.PageMax (default 920dp), or th.PageMaxAt when set.
func ListView ¶
func ListView(th *Theme, list *widget.List, gtx layout.Context, count int, row func(gtx layout.Context, i int) layout.Dimensions) layout.Dimensions
ListView is Scrollable's VIRTUALIZED sibling for long, uniform collections: only the rows intersecting the viewport are laid out, so a 10,000-row list costs a screenful per frame, not 10,000 rows. Scrollable lays its whole content out every frame — right for a screen's mixed content, wrong past a few dozen rows; reach for ListView the moment a collection can grow with data.
list holds the scroll position and must outlive the frame; row lays out item i at the viewport's width.
Example ¶
package main
import (
"gioui.org/layout"
"gioui.org/widget"
lotusui "github.com/ikaito-com/lotusui"
)
func main() {
th := lotusui.NewTheme()
list := widget.List{List: layout.List{Axis: layout.Vertical}}
items := []string{"a", "b", "c"}
render := func(gtx layout.Context) layout.Dimensions {
return lotusui.ListView(th, &list, gtx, len(items), func(gtx layout.Context, i int) layout.Dimensions {
return lotusui.LabelBody(th, items[i]).Layout(gtx)
})
}
_ = render
}
Output:
func OpenURL ¶ added in v0.3.1
OpenURL starts the platform URL handler for u (open / xdg-open / cmd start). It does not wait for the handler to exit. Empty u is an error. No widget and no bundled icon — apps keep their own chrome.
func Progress ¶
Progress renders a determinate progress bar: a track in the subtle fill, the filled portion in the brand solid. value is clamped to [0, 1]; pass a NEGATIVE value for the indeterminate state — a segment sweeping the track on the shared clock (self-invalidating; mount it only while something is actually in flight).
func RegisterIconFS ¶
RegisterIconFS adds an app's own embedded icons to the icon namespace: fsys/dir/<name>.svg becomes SVGIcon(name, …). Registered sources are searched before the built-in set, so an app can also override a built-in icon by reusing its name. Call it from init or main — registration is cheap and safe from any goroutine, and the library stays exactly as heavy as the icons YOU embed.
//go:embed icons/*.svg
var appIcons embed.FS
func init() { lotusui.RegisterIconFS(appIcons, "icons") }
func RightAligned ¶
RightAligned spans the full row width and anchors w to its right edge — the alignment for modal button rows. (A zero-size Flexed spacer does NOT work for this: Flex advances by each child's REPORTED size, so an empty filler collapses and the buttons drift left.)
func SVGIcon ¶
SVGIcon lays out an embedded icon at the given dp size and tint. Renders nothing (zero dims beyond the reserved square) if the icon file isn't embedded, so screens degrade to their text.
func SVGIconButton ¶
func SVGIconButton(th *Theme, btn *widget.Clickable, icon string, size unit.Dp, active bool) layout.Widget
SVGIconButton is a small icon-only clickable using an embedded full-color SVG icon, with the pointer cursor and a comfortable tap inset. active draws the Surface2 pill behind it — the same active language as rows — so toggle buttons (the gear) visibly read as ON; hover shows the same tint as affordance.
func SVGIconButtonTint ¶
func SVGIconButtonTint(th *Theme, btn *widget.Clickable, icon string, size unit.Dp, active bool, tint color.NRGBA) layout.Widget
SVGIconButtonTint is SVGIconButton for MONO icons (the plain fluent set), whose currentColor takes the given tint — e.g. the quiet TextDim pencil. Full-color icons ignore the tint.
func ScreenTitle ¶
ScreenTitle renders a screen's name the app's one way — every screen reuses this: small (14sp semibold, a macOS-toolbar-title weight) and horizontally centered over the CONTENT column — it spans whatever width its parent hands it, so inside LayoutPage's constrained column it centers on the content, not the window.
func Scrollable ¶
func SectionLabel ¶
SectionLabel renders a small, quiet caption used to introduce a group of related content — hierarchy from weight and color, not bold shouting.
func Separator ¶
Separator is the semantic divider: a 1dp hairline in the theme's subtle border ink, horizontal by default. It is the component form of Hairline/VerticalHairline — use it wherever content needs a visual boundary that is not a box.
func SeparatorVertical ¶
SeparatorVertical divides horizontal siblings — a 1dp vertical rule spanning the row's height.
func Show ¶ added in v0.3.1
func Show(th *Theme, gtx layout.Context, when ResponsiveBool, w layout.Widget) layout.Dimensions
Show lays out w only when when resolves true — Chakra display:none analogue for stepped structure. Zero size when hidden.
func SimpleGrid ¶
func SimpleGrid[T any](th *Theme, gtx layout.Context, items []T, p SimpleGridProps, cell func(layout.Context, T) layout.Dimensions) layout.Dimensions
SimpleGrid lays out one cell per item. Continuous mode (Columns unset): column count = min(MaxCols, floor(Max.X / MinChildWidth)). Stepped mode (Columns set): Resolve against Theme.Breakpoints. Rows share the tallest cell's height; a trailing partial row is padded so cells don't stretch.
func Skeleton ¶
Skeleton is the loading placeholder: a rounded block pulsing gently between the theme's subtle fills on the shared clock. Give it the shape of the content it stands in for.
lotusui.Skeleton(th, 220, 16) // a line of text lotusui.Skeleton(th, 40, 40) // an avatar
It self-invalidates — mount it only while loading.
func SkeletonCircle ¶
SkeletonCircle is the round form — avatars, icon slots.
func Sp ¶
Sp scales th.TextSize by ratio, producing a derived type-scale value — e.g. Sp(th, 12.0/16.0) for a 12sp label when the base size is 16sp. This keeps every label's size relative to one base instead of hard-coded magic numbers scattered through views.
func Spacer ¶
Spacer renders a fixed-height vertical gap — the app's default rhythm between stacked elements.
func Spinner ¶
Spinner is the standalone loading indicator: the same three-quarter arc Button's loading state draws, rotating on the frame clock, in the theme's muted ink (pass a Scheme'd color via SpinnerTint for anything else). It self-invalidates — mount it only while loading.
func SpinnerTint ¶
SpinnerTint is Spinner in an explicit color.
func SplitBox ¶
SplitBox is the standard wrapper for a box inside a Split: the rounded surface card around the pane's own content, so appearing and disappearing panes look identical across an app.
func SplitBoxFillScroll ¶ added in v0.3.1
func SplitBoxFillScroll(th *Theme, list *widget.List, maxH int, content layout.Widget) layout.Widget
SplitBoxFillScroll paints card chrome at least maxH tall (Min.Y = Max.Y), flush in a column. Short content stays top-aligned. Content is NOT wrapped in a list — after Card zeros content Min.Y this re-asserts Min.Y = Max.Y (= maxH − 2×Pad) so callers can Flexed-expand a body and pin a Rigid footer. Overflow is the content's job. list is reserved for API symmetry with the other scroll helpers; it is unused here.
func SplitBoxScroll ¶ added in v0.3.1
SplitBoxScroll hugs while the body is shorter than maxH (0 = Max.Y); past that the body scrolls inside the card. Content Max.Y is limited to maxH − 2×CardProps{}.Pad() so children do not paint under the pad.
func SplitColumnScroll ¶ added in v0.3.1
SplitColumnScroll is a fixed-height column viewport. Stack natural-height SplitBoxes inside; the COLUMN scrolls, not each card. maxH <= 0 uses Constraints.Max.Y. Size is always (Max.X, maxH). Inside a list item Max.Y is unbounded — pass an explicit maxH.
func SurfaceCard ¶
SurfaceCard is the design language's standard grouping surface — the elevated Card at the default size. Kept as a convenience (and for Split's boxes); Card is the configurable family.
func Table ¶
Table renders tabular data: a muted header row, hairlines between body rows, cells as arbitrary widgets. For plain text use TableText. Long collections belong in ListView; Table is for the bounded, comparison-shaped data a screen actually shows.
func TitleWithIcons ¶ added in v0.3.1
TitleWithIcons is an in-content / section title with trailing action icons — the counterpart to TopBar (which is screen chrome with an optional leading control). Title is LabelTitle on the left (Flexed); icons are Rigid with Space.XS between them only. Empty icons → title alone.
func TopBar ¶
TopBar is the screen header, a composable: a FIXED-height row (so the title never shifts vertically between screen states), the title dead-center via ScreenTitle, an optional leading widget (the back button) overlaid at the left — and NO background: it sits directly on the page.
func VStack ¶
VStack stacks children vertically with a uniform gap — Chakra's VStack. Children keep their natural width (cross-axis Start).
Example ¶
package main
import (
lotusui "github.com/ikaito-com/lotusui"
)
func main() {
th := lotusui.NewTheme()
w := lotusui.VStack(th.Space.MD,
lotusui.LabelTitle(th, "Section").Layout,
lotusui.Hairline(th),
lotusui.LabelBody(th, "Body under the divider").Layout,
)
_ = w
}
Output:
func VerticalHairline ¶
VerticalHairline draws a 1dp vertical divider spanning the available height. In an UNBOUNDED context (a Rigid child of a row measured at natural height) it falls back to one line-height — a divider must never be the child that decides the row is a mile tall.
func Wrap ¶ added in v0.3.1
Wrap lays children left-to-right and wraps to the next line when the next child would exceed Max.X — Chakra's Wrap / CSS flex-wrap. Each child is measured at its intrinsic width (unconstrained Max.X); a child wider than Max.X alone is laid out at Max.X. Gap is used both between items on a line and between lines. Align is the cross-axis alignment within each line (Middle for text + icons).
Prefer Wrap over HStack for flowing chips/badges; prefer SimpleGrid when you want equal cells and a fixed column count.
Types ¶
type Accordion ¶
type Accordion struct {
// Bordered wraps the whole accordion in a rounded border with
// side padding — the boxed look.
Bordered bool
// Open indexes the expanded item in single mode; -1 = all closed.
Open int
// Multiple switches to independent panels tracked in Expanded.
Multiple bool
Expanded []bool
// contains filtered or unexported fields
}
Accordion is the vertically stacked disclosure: titles that expand one panel of content at a time (set Multiple for independent panels). Expansion animates on the shared clock — content is measured at natural height and revealed by a growing clip, never reflowed mid-flight.
func (*Accordion) Layout ¶
func (a *Accordion) Layout(th *Theme, gtx layout.Context, items ...AccordionItem) layout.Dimensions
type AccordionItem ¶
type AccordionItem struct {
Title string
Content layout.Widget
// Disabled dims the title and ignores clicks.
Disabled bool
}
AccordionItem is one disclosure: a title and its content.
type AlertDialog ¶
type AlertDialog struct {
// contains filtered or unexported fields
}
AlertDialog is the interruption that requires a decision: a Dialog that absorbs every outside click and Escape (no backdrop dismissal, no corner ✕) and offers exactly Cancel and Action. Poll Confirmed and Cancelled each frame while open.
func (*AlertDialog) Appear ¶
func (a *AlertDialog) Appear()
Appear restarts the entrance animation — call on the closed→open transition, exactly like Dialog.
func (*AlertDialog) Cancelled ¶
func (a *AlertDialog) Cancelled(gtx layout.Context) bool
Cancelled reports a click on the cancel button this frame.
func (*AlertDialog) Confirmed ¶
func (a *AlertDialog) Confirmed(gtx layout.Context) bool
Confirmed reports a click on the action button this frame.
func (*AlertDialog) Layout ¶
func (a *AlertDialog) Layout(th *Theme, gtx layout.Context, o AlertDialogProps) layout.Dimensions
Layout renders the dialog at WINDOW constraints, like Dialog.
type AlertDialogProps ¶ added in v0.3.0
type AlertDialogProps struct {
Title string
Description string
// Size picks the dialog width preset (Size2XS…Size2XL).
// Sizes / Width / Widths mirror Dialog when set.
Size Size
Sizes ResponsiveSize
Width unit.Dp
Widths ResponsiveDp
// Media renders above the title — an icon medallion, an image.
Media layout.Widget
Cancel string // empty = "Cancel"
Action string // empty = "Continue"
Destructive bool // renders the action destructively
}
AlertDialogProps are the dialog's texts and role.
type AlertProps ¶ added in v0.3.0
type AlertProps struct {
Variant AlertVariant
Icon string // override the variant's default icon
Title string
Description string
// Action renders at the alert's end — typically a small Button.
Action layout.Widget
// Color re-tints the whole alert from a scale, the pastel way
// (tinted well + deep same-hue ink) — the amber "subscription
// expiring" callout, in any hue, without breaking readability.
Color ColorScale
}
AlertProps are the alert's options. Icon defaults by variant (info / warning); empty Description renders title-only.
type AlertVariant ¶
type AlertVariant int
AlertVariant selects the alert's role.
const ( AlertDefault AlertVariant = iota // neutral callout AlertDestructive // danger ink on a danger tint )
type AttachedEdges ¶
type AttachedEdges struct {
Start, End, Top, Bottom bool
}
AttachedEdges marks the sides of a control that sit flush against a neighbor — those corners render square and the shared border collapses. ButtonGroup sets it on its children; set it by hand only when hand-building attached rows.
type AvatarBadge ¶
type AvatarBadge struct {
Color ColorScale
Icon string
}
AvatarBadge is the avatar's status dot. Color anchors its fill (zero = the theme accent); Icon renders inside, inverted.
type AvatarGroupProps ¶ added in v0.3.0
type AvatarGroupProps struct {
Size Size
// Count renders a trailing "+N" bubble; CountIcon an icon bubble.
Count string
CountIcon string
}
AvatarGroupProps are the overlapping-group's options.
type AvatarProps ¶ added in v0.3.0
type AvatarProps struct {
Initials string
Size Size
Color ColorScale
Scheme *Scheme
// Badge renders a small status dot on the bottom-right rim,
// ringed in the panel background.
Badge *AvatarBadge
}
AvatarProps are the avatar's options. Initials render centered in the circle; empty Initials fall back to the person glyph. Color re-tints the circle from a scale the pastel way (SoftScheme).
type BadgeProps ¶ added in v0.3.0
type BadgeProps struct {
Variant BadgeVariant
Size Size // the shared size presets
// Color re-colors the badge from a ColorScale, the PASTEL way
// (SoftScheme: tinted fill + deep same-hue ink) — the badge
// doctrine holds for any color the caller picks.
Color ColorScale
Scheme *Scheme
Bg, Fg color.NRGBA
// Icon names an embedded icon rendered before the text, tinted
// with the badge's ink.
Icon string
// Start/End render arbitrary widgets before/after the text — a
// Spinner, a dot. The widget owns its own color.
Start, End layout.Widget
}
BadgeProps are the badge's props. Scheme defaults to the theme's Neutral; Bg/Fg, when both set, override the scheme entirely — the escape hatch for status pairs (SuccessBg/Success and friends), which are tokens, not schemes.
type BadgeVariant ¶
type BadgeVariant int
BadgeVariant selects how the badge's scheme paints it.
const ( BadgeDefault BadgeVariant = iota // solid primary fill + contrast text BadgeSecondary // faint neutral fill + ink BadgeDestructive // destructive tint + ink BadgeOutline // border + ink, no fill BadgeGhost // ink only — no fill, no border )
type Breakpoint ¶ added in v0.3.1
Breakpoint is one named step for BreakpointsFrom / MustBreakpoints.
type Breakpoints ¶ added in v0.3.1
type Breakpoints struct {
// contains filtered or unexported fields
}
Breakpoints are named min-widths (dp), mobile-first — Chakra's theme.breakpoints. Compiled once at NewTheme; per-frame resolve is BreakpointIndex (a short ascending walk, zero alloc).
Apps override with WithBreakpoints or ParseBreakpointsJSON — never via registry.json.
func BreakpointsFrom ¶ added in v0.3.1
func BreakpointsFrom(steps []Breakpoint) (Breakpoints, error)
BreakpointsFrom builds a Breakpoints from unordered steps. Names must be unique; at least one step is required. Sorted ascending by Min.
func MustBreakpoints ¶ added in v0.3.1
func MustBreakpoints(steps []Breakpoint) Breakpoints
MustBreakpoints is BreakpointsFrom, panicking on error — for package defaults and tests.
func ParseBreakpointsJSON ¶ added in v0.3.1
func ParseBreakpointsJSON(data []byte) (Breakpoints, error)
ParseBreakpointsJSON reads `{"base":0,"sm":480,"md":768,…}` — values are dp. Apps ship this file; lotusui does not load it at runtime.
func (Breakpoints) IndexOf ¶ added in v0.3.1
func (b Breakpoints) IndexOf(name string) int
IndexOf returns the step index for name, or -1.
func (Breakpoints) Len ¶ added in v0.3.1
func (b Breakpoints) Len() int
Len is the number of named steps.
func (Breakpoints) Min ¶ added in v0.3.1
func (b Breakpoints) Min(i int) unit.Dp
Min returns the min width (dp) at i.
func (Breakpoints) Name ¶ added in v0.3.1
func (b Breakpoints) Name(i int) string
Name returns the step name at i, or "" if out of range.
type ButtonGroupItem ¶
type ButtonGroupItem struct {
Btn *widget.Clickable
Label string
Props ButtonProps
// Separator renders the hairline divider between attached
// neighbors — the split-button seam.
Separator bool
// Widget renders arbitrary content in the slot instead of a
// button.
Widget layout.Widget
// Flex, when non-zero, lets the slot absorb remaining space.
Flex float32
}
ButtonGroupItem is one slot of the group: a button (Btn + Label + Props), a Separator, or an arbitrary Widget carried as-is (an Input — its own chrome stays). Flex gives the slot flexed weight.
func ButtonGroupSeparator ¶
func ButtonGroupSeparator() ButtonGroupItem
ButtonGroupSeparator is the ready-made separator item.
type ButtonGroupProps ¶ added in v0.3.0
type ButtonGroupProps struct {
// Vertical stacks the group top-to-bottom.
Vertical bool
}
ButtonGroupProps are the group's options.
type ButtonProps ¶ added in v0.3.0
type ButtonProps struct {
Variant ButtonVariant
Size Size
// Color re-colors the variant from a ColorScale — the named scales
// (Teal, Pink, …) or any ScaleFrom(anchor). One anchor in, the
// whole interaction ladder out (.500 base, .600 hover, .700
// pressed), so a custom color can never fall out of step with its
// hover and pressed states.
Color ColorScale
// Scheme, when set, wins over Color and the variant's role scheme:
// full manual control of every slot — e.g. Teal.SoftScheme() for
// the pastel construction, or a hand-built Scheme.
Scheme *Scheme
// IconStart / IconEnd name embedded icons (typed constants or your
// registered ones) rendered beside the label, tinted with the
// button's own ink.
IconStart, IconEnd string
// Rounded renders the pill form — full-round corners.
Rounded bool
// Attached marks the sides that sit against a neighbor in a
// ButtonGroup: those corners render square and the seat shadow
// drops. ButtonGroup sets this for its children.
Attached AttachedEdges
Loading bool // shows a spinner (label keeps the width), input off
// LoadingText, when set, replaces the label while Loading instead
// of hiding it under the spinner.
LoadingText string
Disabled bool
}
ButtonProps are the button's props. A button's label is always centered — a full-width action with a start-aligned label is a menu row, not a button; use DropdownMenuItem for those.
Example (Scheme) ¶
package main
import (
"gioui.org/widget"
lotusui "github.com/ikaito-com/lotusui"
)
func main() {
th := lotusui.NewTheme()
var btn widget.Clickable
teal := lotusui.Teal.Scheme() // any ColorScale becomes a button scheme
w := lotusui.Button(th, &btn, "Go", lotusui.ButtonProps{Scheme: &teal})
_ = w
}
Output:
type ButtonVariant ¶
type ButtonVariant int
ButtonVariant selects the button's role and chrome.
const ( ButtonDefault ButtonVariant = iota // solid primary — the call to action ButtonSecondary // muted solid for auxiliary actions ButtonDestructive // solid destructive — Delete-class only ButtonOutline // bordered, quiet ink, fills faintly on hover ButtonGhost // no chrome until hovered ButtonLink // primary ink only; underlines on hover )
type CardProps ¶ added in v0.3.0
type CardProps struct {
Variant CardVariant
Size Size
}
CardProps are the card's props. Size scales the content padding — same Size enum as every other component; no separate pad knob.
type CardVariant ¶
type CardVariant int
CardVariant selects the card chrome.
const ( CardOutline CardVariant = iota // bordered panel, no shadow (default) CardElevated // panel floating on a soft shadow CardSubtle // subtle fill, no border, no shadow )
type Checkbox ¶
type Checkbox struct {
Value bool
// Indeterminate renders a dash instead of a check — the classic
// parent of a partially-selected list. It is a display state; the
// caller decides what a click on it means.
Indeterminate bool
// Invalid turns the unchecked border danger red (save-time
// validation, same contract as Input.Error).
Invalid bool
Disabled bool
Size Size
// contains filtered or unexported fields
}
Checkbox is the checkbox: a rounded box with a check mark when on, a label beside it. Disabled renders quietly and swallows clicks — for states that are facts, not choices (a permission the plan doesn't include). Callers read Clicked and set Value.
type ColorScale ¶
A ColorScale is one hue graded from near-white to near-black in ten steps — the 50…900 convention: 50 is the faintest tint (subtle backgrounds), 500 the anchor (solid fills), 900 the darkest ink. Scales are the raw material palettes and schemes are built from; they are plain values resolved at startup, never computed per frame.
func ScaleFrom ¶
func ScaleFrom(anchor color.NRGBA) ColorScale
ScaleFrom grades a full 50…900 scale from one anchor color: the anchor keeps its hue and saturation and becomes C500; lighter steps interpolate from the anchor toward near-white, darker steps toward near-black — RELATIVE to the anchor's own lightness, so the ladder stays strictly ordered whether the brand color is a pastel or a deep ink. One brand color in, a complete usable scale out.
func (ColorScale) Scheme ¶
func (s ColorScale) Scheme() Scheme
Scheme maps the scale onto the button variants the SATURATED way: C500 solid fill with white text, faint tint for subtle — and the interaction ladder exactly as the web convention has it: base .500, hover .600, active .700 (and .100/.200/.300 for the subtle family).
func (ColorScale) SoftScheme ¶
func (s ColorScale) SoftScheme() Scheme
SoftScheme maps the scale onto the button variants the PASTEL way lotusui's own defaults use: tinted fill with deep same-hue ink — quieter than Scheme, right for interfaces that lead with content. Interaction steps walk the light end of the ladder.
type Dialog ¶
type Dialog struct {
// Size picks a width preset (Size2XS 280dp … Size2XL 840dp; SizeMD,
// the default, is 480dp). Width, when non-zero, overrides it.
// Sizes / Widths, when Set(), override Size / Width per breakpoint.
Size Size
Sizes ResponsiveSize
Width unit.Dp
Widths ResponsiveDp
// HideClose suppresses the corner ✕ on dismissable dialogs —
// backdrop and Escape still work through onClose.
HideClose bool
// contains filtered or unexported fields
}
Dialog is the one overlay primitive, modeled on Chakra-UI's Dialog : a dimmed scrim over the ENTIRE window with a width-capped SurfaceCard centered on it. Like Chakra, it wraps arbitrary content and knows nothing about what's inside; visibility stays with the caller (the isOpen/onClose contract) — don't call Layout when closed.
onClose mirrors Chakra's closeOnOverlayClick: pass the caller's close func to let a backdrop click dismiss (glance-and-dismiss modals), or nil to absorb outside clicks without dismissing (typed confirmations — anywhere an accidental dismissal costs more than it saves).
Lay the modal out at WINDOW constraints (your app shell's top layer / portal) — laid out inside a content column it would inherit that column's constraints, which is exactly the "scrim only covers part of the window, card off-center" bug this type exists to end.
type DropdownMenuSub ¶
type DropdownMenuSub struct {
// Width is the side panel's max width; zero means min 200dp and
// grow with content (shadcn min-w). Non-zero: hug up to Width.
Width unit.Dp
// contains filtered or unexported fields
}
DropdownMenuSub is the nested submenu: a trigger row with a trailing chevron whose side panel opens while the pointer rests on the row or the panel itself. One struct per submenu; use its Item method inside a menu's item list. If Item's widget is laid out more than once per frame, only the hovered site paints the side panel.
type DropdownMenuTrigger ¶
type DropdownMenuTrigger struct {
Open bool
// KeepOpen suppresses close-on-selection — for menus of checkbox
// or radio rows where picking is not leaving.
KeepOpen bool
// Width is the panel's max width; zero means min 224dp and grow
// with content (shadcn min-w). Non-zero: hug up to Width.
Width unit.Dp
// Variant styles the trigger button; the zero value renders
// outline (the family default), so pass ButtonGhost or ButtonLink
// for quieter triggers.
Variant ButtonVariant
// Icon names an embedded icon on the trigger. Empty label + Icon
// = icon-only (the BreadcrumbEllipsis-as-menu-trigger pattern).
// With a label it sits at IconStart.
Icon string
// Size is the shared size preset for the trigger button.
Size Size
// Align positions the panel against the trigger edge. Zero is
// PopoverCenter (same enum as Popover); set PopoverStart for a
// leading-edge menu, PopoverEnd for a trailing-edge one.
Align PopoverAlign
// contains filtered or unexported fields
}
DropdownMenuTrigger is the anchored, floating form of the family — the standard shape: a trigger button that opens the panel on the portal layer, 4dp below itself. Rows keep their caller-owned clickables; the panel closes on selection (any release inside), on a press anywhere else, and on Escape. Checkbox and radio rows usually WANT the menu to stay open — hold KeepOpen for those.
Layout may be called multiple times per frame on one trigger; each call is a distinct site with its own button. Only the active site paints the floating panel while Open.
type FieldProps ¶ added in v0.3.0
type FieldProps struct {
Label string
Helper string // quiet guidance under the control
Error string // replaces Helper in danger ink when non-empty
Required bool // marks the label with a danger asterisk
}
Field is the form-field wrapper: label, helper text, error message and required marker around ANY control — an Input, a Dropdown, a Checkbox group, your own widget. It is pure structure (the lean-core rule: labels and messages are composition, not props of every control), so each part costs nothing when unused.
lotusui.Field(th, lotusui.FieldProps{
Label: "Email",
Helper: "We'll never share it.",
Required: true,
}, func(gtx C) D { return email.LayoutField(th, gtx, "you@example.com") })
type GlossarySeg ¶ added in v0.3.1
GlossarySeg is one run from SplitGlossary: either plain text or a term.
func SplitGlossary ¶ added in v0.3.1
func SplitGlossary(text string, terms []GlossaryTerm) []GlossarySeg
SplitGlossary splits text into plain and term segments. Matching is literal and longest-first (same span: longer Term wins). Empty text or no terms yields a single plain segment when text is non-empty.
type GlossaryTerm ¶ added in v0.3.1
GlossaryTerm is one in-text term with a HoverCard tip. Term is matched as a literal substring; longest Term wins when spans overlap.
type Grid ¶
type Grid struct {
Columns int // number of equal-width tracks when Cols unset; min 1
Cols ResponsiveInt // stepped columns; when Set(), overrides Columns
Gap unit.Dp // both axes, unless overridden below
RowGap unit.Dp
ColGap unit.Dp
Gaps ResponsiveDp // when Set(), both axes (unless RowGap/ColGap set after resolve)
}
Grid is the 2D layout primitive: equal-width tracks (repeat(N, 1fr) in web terms), items auto-flowing row-major, each optionally spanning columns and rows. Row heights derive from content; an item spanning rows stretches across them.
Columns is the fixed track count. Cols, when set (Cols(n).At(…)), wins and resolves against Theme.Breakpoints each frame.
type GridItem ¶
type GridItem struct {
ColSpan, RowSpan int
ColSpans, RowSpans ResponsiveInt
W layout.Widget
}
GridItem is one grid cell: a widget plus how many tracks it spans. Zero spans mean 1. ColSpans / RowSpans override scalars when Set().
type HoverCard ¶ added in v0.3.1
type HoverCard struct {
// Side positions the card; bottom is the default.
Side HoverCardSide
// Align positions the card along the side. Zero is PopoverCenter
// (shadcn HoverCardContent). A start-aligned card on a short
// trigger looks detached — the bulk sits far beside the anchor.
Align PopoverAlign
// OpenDelay / CloseDelay override the defaults when non-zero.
OpenDelay, CloseDelay time.Duration
// Width is the maximum card width; zero means 320dp (shadcn w-80).
// The card hugs its content up to that max — a short tip on a short
// trigger (e.g. "GB") stays clipped to the word instead of sitting
// in an empty 320dp slab that only looks centered in chrome.
Width unit.Dp
// Disabled prevents opening (chakra).
Disabled bool
// contains filtered or unexported fields
}
func (*HoverCard) Layout ¶ added in v0.3.1
func (h *HoverCard) Layout(th *Theme, gtx layout.Context, content, trigger layout.Widget) layout.Dimensions
Layout wraps trigger; content is the card body. The trigger keeps its own interactions (pass-through hover). The card opens after OpenDelay and closes after CloseDelay once the pointer has left both the trigger and the card.
type HoverCardSide ¶ added in v0.3.1
type HoverCardSide int
HoverCard is the hover-preview panel: rest the pointer on a trigger and a content card floats in on the portal layer — for sighted users to preview what's behind a link (shadcn Hover Card). Unlike Tooltip (inverted chrome, a string label), HoverCard is a BgPanel card with arbitrary content and stays open while the pointer is over the card itself.
Layout may be called multiple times per frame on the same HoverCard (one jargon tip shared across every "GB" in a table). Each call is a distinct trigger site; only the hovered site paints the floating card — never one open state spawning N stacked panels.
var tip lotusui.HoverCard tip.Layout(th, gtx, cardBody, trigger)
HoverCardSide selects where the card floats relative to the trigger.
const ( HoverCardBottom HoverCardSide = iota // default HoverCardTop HoverCardLeft HoverCardRight )
type Input ¶
type Input struct {
Editor widget.Editor
Variant InputVariant // Outline (default), Subtle, Flushed
Size Size // the shared size presets
Filter string // allow-list; "" accepts everything
Transform func(string) string // same-frame rewrite; nil = none
Error string
Disabled bool // read-only, dimmed, no caret
// Start and End render INSIDE the field, beside the editor — an
// icon, a small button (a clear ✕, a visibility eye), any widget.
// nil costs nothing: pure composition, the lean-core rule.
Start, End layout.Widget
// Top and Bottom render as full-width rows INSIDE the frame,
// above/below the editor line — the block addons (a header, a
// status row with actions).
Top, Bottom layout.Widget
}
Input is the single-line text input: quiet label above a bordered field with a hint. Domain rules stay in YOUR app — the component only offers the generic input-layer mechanisms:
- Filter is Gio's allow-list: characters outside it are never inserted at all, the idiomatic way to reject input (no red flash, no beep — the character simply doesn't appear).
- Transform rewrites the text in the same frame it changes (e.g. strings.ToLower for lowercase-only identifiers) — a typed "A" appears instantly as "a". When the rewrite preserves length, the caret and selection survive unchanged.
- Error, set by your save-time validation, turns the border red and renders the message below the field.
func (*Input) ApplyConstraints ¶
func (f *Input) ApplyConstraints()
ApplyConstraints enforces the input-layer rules (allow-list + transform). Layout calls it automatically; call it yourself only when a composite field renders f.Editor directly inside its own frame.
func (*Input) LayoutField ¶
LayoutField renders the BARE field — no label, no messages. Wrap it in Field for labels/helper/error structure, or use Layout for the common label+error shorthand.
func (*Input) LayoutSuffix ¶
func (f *Input) LayoutSuffix(th *Theme, gtx layout.Context, label, hint, suffix string) layout.Dimensions
LayoutSuffix is Layout with an optional NON-EDITABLE suffix segment beside the input (a fixed domain, a generated qualifier): two boxes side by side, the right one quiet and fixed — the base text is the user's, the suffix is your app's truth.
type InputOTP ¶
type InputOTP struct {
// Length is the code length; zero means 6.
Length int
// Groups splits the slots into separated groups (e.g. {3, 3} =
// two groups of three with a dash between); nil = one group.
Groups []int
// Filter is the allow-list; empty accepts everything —
// "0123456789" is the digits-only pattern.
Filter string
Disabled bool
Invalid bool
// contains filtered or unexported fields
}
InputOTP is the one-time-code input: character slots rendered as attached boxes driven by ONE hidden editor — click anywhere on the row, type or paste, and the code fills left to right. The active slot (where the next character lands) carries the focus ring while the group is focused.
type InputVariant ¶
type InputVariant int
InputVariant selects the field chrome.
const ( InputOutline InputVariant = iota // bordered panel field (default) InputSubtle // filled with BgSubtle, borderless InputFlushed // underline only, no fill, no radius )
type Pagination ¶
type Pagination struct {
Page int
// Simple renders numbered links only — no previous/next, no
// elision.
Simple bool
// contains filtered or unexported fields
}
Pagination is the page selector: previous/next plus numbered pages, long ranges elided around the current page. Page is 1-based and lives on the struct; clicks are processed at the top of Layout.
func (*Pagination) Layout ¶
func (p *Pagination) Layout(th *Theme, gtx layout.Context, total int) layout.Dimensions
type Palette ¶
type Palette struct {
// Backgrounds, faint → prominent.
Bg color.NRGBA // the canvas: window/page background
BgSubtle color.NRGBA // slight elevation: chip fills, hover, track fills
BgMuted color.NRGBA // a step past subtle: pressed rows, quiet wells
BgEmphasized color.NRGBA // the strongest neutral fill
BgPanel color.NRGBA // panels floating on the canvas: cards, sidebars, inputs
BgInverted color.NRGBA // dark surface for inverted moments (tooltips)
// Borders, faint → prominent.
BorderSubtle color.NRGBA // 1dp dividers between content
BorderMuted color.NRGBA // between divider and outline
Border color.NRGBA // panel outlines
BorderEmphasized color.NRGBA // outlines that must assert (focus, drag targets)
// Foreground (text and icons), prominent → faint.
Fg color.NRGBA // headings, primary values
FgMuted color.NRGBA // body copy
FgSubtle color.NRGBA // captions, meta, section labels
FgDisabled color.NRGBA // placeholders, disabled text
FgInverted color.NRGBA // text/icons on BgInverted
// The brand, in the standard color-palette slots.
BrandSolid color.NRGBA // solid brand fill — buttons, selections
BrandSubtle color.NRGBA // faint brand fill — subtle-variant backgrounds
BrandFg color.NRGBA // readable same-hue ink on light surfaces
BrandEmphasized color.NRGBA // pressed/darker brand fill
BrandContrast color.NRGBA // text/icons on BrandSolid
// Status pairs: an ink and its pastel background. Badges render as
// tinted pill + deep ink text, never saturated fill + white text.
Success color.NRGBA
SuccessBg color.NRGBA
Warning color.NRGBA
WarningBg color.NRGBA
Info color.NRGBA
InfoBg color.NRGBA
Danger color.NRGBA
DangerBg color.NRGBA
DangerContrast color.NRGBA // text/icons on solid Danger fills
Overlay color.NRGBA // the modal scrim
FocusRing color.NRGBA // keyboard-focus ring around interactive controls
}
Palette is a theme's single source of truth for color: the standard semantic-token vocabulary (bg / fg / border ladders, brand slots, success / warning / info / danger status pairs) so anyone who has themed a modern component library already knows every name. Every color a lotusui component paints is one of these tokens — swap the Palette (NewTheme(WithPalette(p))) and every component follows; there are no hidden hard-coded colors.
func (Palette) Accent ¶
Accent is the brand scheme — the app's one accent. Its interaction steps walk the palette's own brand ladder: Subtle → Solid → Emphasized, so hover and press feel like the same hue deepening.
func (Palette) DangerScheme ¶
DangerScheme is the destructive scheme — Delete-class actions exclusively.
type Popover ¶
type Popover struct {
Open bool
// Width is the maximum panel width. Zero matches the anchor width
// (dropdown-under-button). Non-zero: the panel hugs content up to
// Width — same doctrine as HoverCard.
Width unit.Dp
// Align positions the panel against the anchor edge.
Align PopoverAlign
// contains filtered or unexported fields
}
type PopoverAlign ¶
type PopoverAlign int
Popover is the anchored floating panel for arbitrary content — the general form of Select's dropdown, built on the same portal primitive. The caller owns Open (toggle it from its trigger's click); pressing anywhere else or Escape closes it.
if trigger.Clicked(gtx) { pop.Open = !pop.Open }
dims := lotusui.Button(th, &trigger, "Open", lotusui.ButtonProps{})(gtx)
pop.Layout(th, gtx, dims.Size, panelContent)
PopoverAlign positions the panel's horizontal edge relative to the anchor. The zero value is Center — matching shadcn Popover / HoverCardContent (`align="center"`). Start shares the leading edge; End shares the trailing edge.
const ( PopoverCenter PopoverAlign = iota PopoverStart PopoverEnd )
type RadioGroup ¶
type RadioGroup struct {
Options []RadioOption
Size Size
// Invalid renders danger chrome on every circle.
Invalid bool
// contains filtered or unexported fields
}
RadioGroup is the exclusive choice: labeled circles stacked vertically, exactly one selected. Options carry their own Description and Disabled flags, and the choice is read and written as a VALUE — the cursor is unexported on purpose, because an index is a fact about this list's current order and must never reach app state, storage or a wire.
plan := lotusui.RadioGroup{Options: []lotusui.RadioOption{
{Label: "Starter", Value: "starter", Description: "For side projects."},
{Label: "Pro", Value: "pro", Description: "For teams shipping daily."},
}}
plan.SetValue(stored) // an unknown value clears, never picks option 0
plan.Layout(th, gtx)
stored = plan.Value()
Clicks are processed at the top of Layout, so the click's own frame renders the new selection.
func (*RadioGroup) Chosen ¶ added in v0.2.0
func (r *RadioGroup) Chosen() bool
Chosen reports whether an option is currently selected.
func (*RadioGroup) Clear ¶ added in v0.2.0
func (r *RadioGroup) Clear()
Clear drops the choice — nothing selected.
func (*RadioGroup) Layout ¶
func (r *RadioGroup) Layout(th *Theme, gtx layout.Context) layout.Dimensions
func (*RadioGroup) SetValue ¶ added in v0.2.0
func (r *RadioGroup) SetValue(v string)
SetValue chooses the option carrying v. An unknown value clears the choice, so a stored value that no longer exists leaves nothing selected instead of silently meaning something else.
func (*RadioGroup) Value ¶ added in v0.2.0
func (r *RadioGroup) Value() string
Value is the chosen option's value ("" when nothing is chosen).
type RadioOption ¶ added in v0.2.0
RadioOption is one radio choice — the choice contract lives with SelectOption; Description renders muted under the label and Disabled makes this one option unclickable (both replacing the index-aligned slices RadioGroup used to carry).
func RadioOpts ¶ added in v0.2.0
func RadioOpts(labels ...string) []RadioOption
RadioOpts builds label-only radio options — the shorthand when the label IS the datum.
func (RadioOption) Val ¶ added in v0.2.0
func (o RadioOption) Val() string
Val is the option's stored value — its Label when Value is empty.
type RadiusScale ¶
RadiusScale is a theme's corner-radius scale.
type ResponsiveBool ¶ added in v0.3.1
type ResponsiveBool struct {
// contains filtered or unexported fields
}
ResponsiveBool is a mobile-first bool (Show / hide).
func Bools ¶ added in v0.3.1
func Bools(base bool) ResponsiveBool
Bools starts a responsive bool at base.
func (ResponsiveBool) At ¶ added in v0.3.1
func (r ResponsiveBool) At(name string, v bool) ResponsiveBool
At adds a bool override at a named breakpoint.
func (ResponsiveBool) Resolve ¶ added in v0.3.1
func (r ResponsiveBool) Resolve(th *Theme, gtx layout.Context) bool
Resolve returns the bool for the active breakpoint.
func (ResponsiveBool) ResolveAt ¶ added in v0.3.1
func (r ResponsiveBool) ResolveAt(th *Theme, idx int) bool
ResolveAt is Resolve with a precomputed BreakpointIndex.
func (ResponsiveBool) Set ¶ added in v0.3.1
func (r ResponsiveBool) Set() bool
Set reports whether Bools/At configured this value.
type ResponsiveDp ¶ added in v0.3.1
type ResponsiveDp struct {
// contains filtered or unexported fields
}
ResponsiveDp is a mobile-first dp (gaps, page max).
func (ResponsiveDp) At ¶ added in v0.3.1
func (r ResponsiveDp) At(name string, v unit.Dp) ResponsiveDp
At adds a dp override at a named breakpoint.
func (ResponsiveDp) ResolveAt ¶ added in v0.3.1
func (r ResponsiveDp) ResolveAt(th *Theme, idx int) unit.Dp
ResolveAt is Resolve with a precomputed BreakpointIndex.
func (ResponsiveDp) Set ¶ added in v0.3.1
func (r ResponsiveDp) Set() bool
Set reports whether Dps/At configured this value.
type ResponsiveInt ¶ added in v0.3.1
type ResponsiveInt struct {
// contains filtered or unexported fields
}
ResponsiveInt is a mobile-first int (columns, spans). Build with Cols(base).At("md", 2). Resolve is zero-alloc.
func Cols ¶ added in v0.3.1
func Cols(base int) ResponsiveInt
Cols starts a responsive column/span value at base (always applies).
func (ResponsiveInt) At ¶ added in v0.3.1
func (r ResponsiveInt) At(name string, v int) ResponsiveInt
At adds an override at a named breakpoint (Chakra object syntax). Unknown names are ignored at resolve time. Max 8 overrides.
func (ResponsiveInt) Compile ¶ added in v0.3.1
func (r ResponsiveInt) Compile(bp Breakpoints) []int
Compile densifies against bp for callers that want a one-shot slice (startup). Per-frame code should prefer Resolve.
func (ResponsiveInt) Resolve ¶ added in v0.3.1
func (r ResponsiveInt) Resolve(th *Theme, gtx layout.Context) int
Resolve returns the value for the active breakpoint (mobile-first).
func (ResponsiveInt) ResolveAt ¶ added in v0.3.1
func (r ResponsiveInt) ResolveAt(th *Theme, idx int) int
ResolveAt is Resolve with a precomputed BreakpointIndex — use when resolving several responsive props in one frame.
func (ResponsiveInt) Set ¶ added in v0.3.1
func (r ResponsiveInt) Set() bool
Set reports whether any Cols/At configured this value.
type ResponsiveSize ¶ added in v0.3.1
type ResponsiveSize struct {
// contains filtered or unexported fields
}
ResponsiveSize is a mobile-first Size — for Dialog / AlertDialog width presets (density Size on Button stays a plain Size).
func Sizes ¶ added in v0.3.1
func Sizes(base Size) ResponsiveSize
Sizes starts a responsive Size at base.
func (ResponsiveSize) At ¶ added in v0.3.1
func (r ResponsiveSize) At(name string, v Size) ResponsiveSize
At adds a Size override at a named breakpoint.
func (ResponsiveSize) Resolve ¶ added in v0.3.1
func (r ResponsiveSize) Resolve(th *Theme, gtx layout.Context) Size
Resolve returns the Size for the active breakpoint.
func (ResponsiveSize) ResolveAt ¶ added in v0.3.1
func (r ResponsiveSize) ResolveAt(th *Theme, idx int) Size
ResolveAt is Resolve with a precomputed BreakpointIndex.
func (ResponsiveSize) Set ¶ added in v0.3.1
func (r ResponsiveSize) Set() bool
Set reports whether Sizes/At configured this value.
type Scheme ¶
type Scheme struct {
Solid color.NRGBA // solid variant background
SolidHover color.NRGBA // …while hovered (a scale step darker)
SolidActive color.NRGBA // …while pressed (one more step)
OnSolid color.NRGBA // text/icons on Solid
Subtle color.NRGBA // subtle variant background
SubtleHover color.NRGBA // …while hovered
SubtleActive color.NRGBA // …while pressed
OnSubtle color.NRGBA // text on Subtle / Outline / Ghost
Outline color.NRGBA // outline variant border
}
Scheme is a semantic color scheme: how one color role renders across the Button variants (and any future colored surface), INCLUDING its interaction steps — base, hover, active — the .500/.600/.700 laddering of a color scale. The theme exposes three: Accent (the brand), Neutral (the greys), Danger (destructive only). Schemes are DERIVED — from Palette tokens or a ColorScale's steps — so a custom palette or scale propagates to every variant and every interaction state with no extra configuration. Zero Hover/Active fields fall back to an arithmetic shade of the base, so hand-built schemes keep working.
type Select ¶
type Select struct {
Options []SelectOption
// Groups, when set, wins over Options: options render under muted
// group labels with separators between groups, flattened in order.
Groups []SelectGroup
// Size is the shared size preset for the trigger frame.
Size Size
// Placeholder shows (in disabled ink) while nothing is chosen —
// the "Choose one…" state Clear() puts a form in.
Placeholder string
// Disabled freezes the control on its current choice: no pointer
// cursor, no opening, dimmed value — for identity fields that
// cannot change after creation.
Disabled bool
// Invalid renders the trigger in danger chrome — pair it with a
// Field error message.
Invalid bool
// AlignItemWithTrigger positions the OPEN panel so the selected
// row sits directly over the trigger (the native-select feel),
// instead of dropping below it. Long lists still scroll; the
// alignment accounts for the scrolled-away rows.
AlignItemWithTrigger bool
// contains filtered or unexported fields
}
func (*Select) Clear ¶ added in v0.2.0
func (d *Select) Clear()
Clear drops the choice back to the placeholder state.
type SelectGroup ¶
type SelectGroup struct {
Label string
Options []SelectOption
}
SelectGroup labels a run of options — rendered as a muted group label above its options, with a separator between groups.
type SelectOption ¶ added in v0.2.0
type SelectOption struct {
Label string
Value string
// Meta is optional secondary text on the far right of the option
// row (a count, shortcut, …). Empty omits it. The selected check
// still sits after Meta.
Meta string
}
Select is the select control: a bordered trigger showing the current choice with a chevron; clicking it opens a FLOATING panel of options over the content beneath (the shared portal primitive), with the selected row check-marked. Picking an option, pressing anywhere else, or Escape closes it. SelectOption is one choice: what the user READS (Label) and what the app STORES (Value) — HTML's `<option value="…">`.
The choice contract ¶
Every choice component in lotusui — Select, RadioGroup, Tabs, ToggleGroup — follows the same rules, with its OWN option type carrying only what that component renders (RadioOption adds a Description, TabOption an Icon, and so on):
- Val() is the stored value: Value, or Label when Value is empty (HTML's rule).
- The component exposes Value() / SetValue(v) / Clear() / Chosen(). The cursor is UNEXPORTED: an index is a fact about one list's current order, so it must never reach app state, storage or a wire. Reordering or rewording a list can then never change what stored data means.
- The zero value selects the FIRST option, like a <select> with no `selected` attribute.
- SetValue with an unknown value CLEARS the choice rather than falling back to option 0, so a stored value that no longer exists shows the placeholder instead of silently meaning something else.
func SelectOpts ¶ added in v0.3.0
func SelectOpts(labels ...string) []SelectOption
SelectOpts builds label-only options, where each option's value IS its label — the shorthand for lists whose text is already the datum ("10", "25", "us-east-1"). Give explicit Values whenever the label is prose the product might reword. RadioOpts, TabOpts and ToggleOpts are the same shorthand for the other components.
func (SelectOption) Val ¶ added in v0.2.0
func (o SelectOption) Val() string
Val is an option's stored value — its Label when Value is empty.
type SimpleGridProps ¶ added in v0.3.1
type SimpleGridProps struct {
MinChildWidth unit.Dp
MaxCols int
Columns ResponsiveInt
Gap unit.Dp
Gaps ResponsiveDp
}
SimpleGridProps configures SimpleGrid. When Columns is Set(), column count resolves from Theme.Breakpoints (Chakra columns={{…}}). Otherwise columns derive continuously from MinChildWidth / MaxCols.
type Size ¶
type Size int
Size selects a component's size preset — shared by Button, Checkbox and Switch, so "SizeSM" means the same step everywhere.
type Slider ¶
type Slider struct {
Value float32
Values []float32
Step float32
Vertical bool
Disabled bool
// contains filtered or unexported fields
}
Slider is the draggable value control: a track, the filled range in the brand solid, a round thumb. Value is a fraction in [0, 1] — map it to your domain at the call site; Step, when non-zero, snaps the fraction to multiples (e.g. 0.25 for quarters).
Values, when non-empty, switches to MULTI-THUMB mode: one thumb per entry, kept ordered, the fill spanning first to last (two entries is the range slider). Vertical rotates the axis — cap the height from the call site; the value grows upward.
type SpaceScale ¶
SpaceScale is a theme's 8pt spacing scale.
type Split ¶
type Split struct {
// contains filtered or unexported fields
}
Split arranges a screen's main panes as a CAROUSEL. All the screen's boxes live on one horizontal strip behind an overflow-hidden viewport; the screen's state (depth) decides what the viewport shows:
depth 0 — box 0 takes the full width, hiding the others laterally
depth 1 — boxes 0 and 1 side by side, half each
depth n — boxes n-1 and n side by side; everything before has
translated off to the left
Two eased values drive every transition: box 0's width fraction (full ↔ half, the expand/shrink) and the strip's X translation (the carousel move). Boxes are always laid out at their natural width and only ever REVEALED or HIDDEN by the viewport's edges — content never re-flows mid-animation, so a disappearing box stays visually identical while it slides away.
func (*Split) Layout ¶
func (s *Split) Layout(gtx layout.Context, gap unit.Dp, depth int, boxes ...layout.Widget) layout.Dimensions
Layout renders the strip at the given depth. boxes beyond the depth still get their slot on the strip (off-screen right); boxes before depth-1 sit off-screen left. Pass every box the screen can show — including ones currently hidden — so mid-animation frames render their content sliding, never popping.
func (*Split) LayoutSolo ¶
func (s *Split) LayoutSolo(gtx layout.Context, gap unit.Dp, solo bool, box0, box1 layout.Widget) layout.Dimensions
LayoutSolo is the strip's FULL-WIDTH pivot: two boxes, one visible at a time — solo=false shows box0, solo=true slides the strip left so box1 occupies the whole viewport. Pure translation of natural-width frames (the no-reflow doctrine): both boxes keep full width for the entire flight.
type Stack ¶
type Stack struct {
Axis layout.Axis // layout.Vertical (default) or layout.Horizontal
Gap unit.Dp // uniform spacing between children
Align layout.Alignment // cross-axis alignment; layout.Start is the zero value
}
Stack lays out children along one axis with a uniform gap between them — Chakra UI's Stack, as a Gio widget. Children size themselves; the gap is the component's whole job, so screens stop hand-weaving Spacer children between rows.
type Switch ¶
type Switch struct {
Value bool
Size Size
Disabled bool // dimmed, swallows clicks — a fact, not a choice
Invalid bool // danger ring — save-time validation
// contains filtered or unexported fields
}
Switch is the toggle: a rounded track with a sliding thumb, accent-colored when on, animated on the app's shared clock. Value is the state; clicking flips it.
type TabOption ¶ added in v0.2.0
TabOption is one tab — the choice contract lives with SelectOption; Icon renders before the label and Disabled dims the tab and drops its cursor (both replacing the index-aligned slices Tabs used to carry).
type TableProps ¶ added in v0.3.0
type TableProps struct {
// Widths are per-column flex weights; nil = equal columns.
Widths []float32
Footer []string
// Caption renders muted under the table.
Caption string
}
TableProps are the table's options.
type Tabs ¶
type Tabs struct {
Options []TabOption
Variant TabsVariant
// Vertical stacks the tab strip in a column — pair it with your
// content beside it.
Vertical bool
// contains filtered or unexported fields
}
Tabs is a row of tab labels; Variant picks the pill or underline look. Options carry each tab's Label, Value, Icon and Disabled flag, and the selection is read and written as a VALUE — the cursor is unexported, because a tab's index is a fact about this strip's current order, not something an app should store or route on.
tabs := lotusui.Tabs{Options: lotusui.TabOpts("Account", "Password")}
tabs.Update(gtx) // BEFORE anything reads the selection
switch tabs.Value() { ... }
tabs.Layout(th, gtx)
func (*Tabs) SetValue ¶ added in v0.2.0
SetValue selects the tab carrying v. An unknown value selects nothing rather than silently falling back to the first tab.
func (*Tabs) Update ¶
Update processes tab clicks. It MUST run before anything reads the selection in the same frame — otherwise the click's own frame renders the stale tab and the switch only shows on the next incidental event, which reads as lag. This bug shipped TWICE (Create/Select, twice in the original app), so Layout deliberately does NOT process clicks anymore: a consumer that forgets Update gets DEAD tabs — impossible to miss in the first manual test — instead of subtle lag that survives review. Call Update in the frame's handler phase (or immediately before the Value() read).
type TabsVariant ¶
type TabsVariant int
TabsVariant selects the tab look.
const ( // TabsDefault: the whole strip sits in a muted rounded well; the // active tab is a raised panel inside it — the standard look. TabsDefault TabsVariant = iota // TabsLine: quiet labels over an underline that marks the active // tab — the classic tab strip. TabsLine // TabsSubtle: pill-styled labels, the active one filled BgSubtle — // the same active language as rows and toggles everywhere else. TabsSubtle )
type Textarea ¶
type Textarea struct {
Editor widget.Editor
Size Size
Variant InputVariant
Error string
Disabled bool
// Rows is the minimum visible line count; zero means 3.
Rows int
}
Textarea is the multi-line sibling of Input: the same frame chrome and size presets, a wrapping editor inside, with a minimum height in rows. Behavior mechanisms mirror Input: Error for danger chrome, Disabled for read-only.
func (*Textarea) Layout ¶
Layout is LayoutField wrapped in a Field with label and the textarea's own error.
func (*Textarea) LayoutField ¶
LayoutField renders the bare textarea; wrap it in Field for label, helper and error structure.
type Theme ¶
type Theme struct {
Material *material.Theme
Palette Palette
Radius RadiusScale
Space SpaceScale
// Breakpoints are named min-widths (dp) for responsive layout
// props — Columns, gaps, Show, PageMax. DefaultBreakpoints unless
// WithBreakpoints / ParseBreakpointsJSON.
Breakpoints Breakpoints
// PageMax caps LayoutPage's readable column (default 920dp).
// PageMaxAt, when set, overrides PageMax per breakpoint.
PageMax unit.Dp
PageMaxAt ResponsiveDp
// BrandScale is the palette's brand hue graded 50…900 —
// automatically derived from Palette.BrandFg at construction, so
// defining ONE custom brand color gives the whole app a full scale
// (th.BrandScale.C50 tints, th.BrandScale.Scheme() buttons, …)
// with no extra configuration.
BrandScale ColorScale
// contains filtered or unexported fields
}
Theme bundles the material theme (used for widget defaults like buttons and text fields) with the design tokens lotusui components read: Palette for color, Radius and Space for shape and rhythm. Build one with NewTheme at startup and pass it everywhere; all customization is resolved here, never per frame.
func NewTheme ¶
func NewTheme(opts ...ThemeOption) *Theme
NewTheme builds a Theme: the ikaito defaults, then any options.
th := lotusui.NewTheme() // ikaito look th := lotusui.NewTheme(lotusui.WithPalette(myBrand)) // custom look
Example (CustomPalette) ¶
package main
import (
lotusui "github.com/ikaito-com/lotusui"
)
func main() {
p := lotusui.DefaultPalette
p.BrandFg = lotusui.Teal.C600 // one brand color…
th := lotusui.NewTheme(lotusui.WithPalette(p))
_ = th.BrandScale // …and the graded 50…900 scale is derived automatically
}
Output:
func (*Theme) ApplyPendingShaper ¶
func (t *Theme) ApplyPendingShaper()
ApplyPendingShaper swaps the upgraded shaper in — called at the top of every frame (UI goroutine), so the swap can never race a render.
func (*Theme) BreakpointIndex ¶ added in v0.3.1
BreakpointIndex is the largest step whose min width ≤ Max.X (mobile-first). Zero alloc; O(number of steps).
func (*Theme) BreakpointName ¶ added in v0.3.1
BreakpointName is the active step name (for demos / debugging).
func (*Theme) SetExtraFaces ¶
SetExtraFaces rebuilds the shaper with additional runtime-loaded font faces (e.g. a CJK face fetched from a server) appended after the theme's base collection, system-font fallback included. Safe from any goroutine; the swap lands via ApplyPendingShaper on the next frame. Apps that call this should NOT also call UpgradeShaperAsync — the two would race to set the pending shaper and the loser's faces would be dropped.
func (*Theme) UpgradeShaperAsync ¶
func (t *Theme) UpgradeShaperAsync(invalidate func())
UpgradeShaperAsync builds the full text shaper (system-font fallback included) off the startup path and hands it to ApplyPendingShaper. invalidate is Window.Invalidate — safe from any goroutine.
type ThemeOption ¶
type ThemeOption func(*Theme)
ThemeOption customizes NewTheme. Options are applied once, at construction — theming has zero per-frame cost.
func WithBreakpoints ¶ added in v0.3.1
func WithBreakpoints(bp Breakpoints) ThemeOption
WithBreakpoints replaces Theme.Breakpoints (default: DefaultBreakpoints).
func WithFaces ¶
func WithFaces(faces []font.FontFace) ThemeOption
WithFaces replaces the embedded DM Sans as the primary font collection — the brand font for an app that isn't ikaito's. System fallback still arrives via UpgradeShaperAsync.
func WithPageMax ¶ added in v0.3.1
func WithPageMax(max unit.Dp) ThemeOption
WithPageMax sets LayoutPage's readable column cap (default 920dp).
func WithPalette ¶
func WithPalette(p Palette) ThemeOption
WithPalette replaces the color tokens. Components derive every fill, ink, border and scheme from these, so one palette swap restyles the whole library consistently.
func WithRadius ¶
func WithRadius(r RadiusScale) ThemeOption
WithRadius replaces the corner-radius scale.
func WithTextSize ¶
func WithTextSize(sz unit.Sp) ThemeOption
WithTextSize sets the base text size the whole type scale derives from (default 16sp; see Sp).
type Toast ¶
type Toast struct {
Title string
Description string
Variant ToastVariant
// ID names the toast so Update can replace it in place — the
// promise pattern: Add a Loading toast, Update it on completion.
ID string
// Loading renders a spinner before the title.
Loading bool
// Duration before auto-dismiss; zero means 4s.
Duration time.Duration
}
Toast is one transient notification.
type ToastVariant ¶
type ToastVariant int
ToastVariant selects the toast's role.
const ( ToastDefault ToastVariant = iota ToastDestructive // danger ink for failures ToastSuccess // success ink ToastInfo // info ink ToastWarning // warning ink )
type Toaster ¶
type Toaster struct {
// contains filtered or unexported fields
}
Toaster owns the toast queue: Add from anywhere, Layout ONCE per frame at WINDOW constraints (the same portal rule as Dialog) — the stack renders bottom-right, newest at the bottom, each auto- dismissing after its duration. Self-invalidates while non-empty.
type Toggle ¶
type Toggle struct {
On bool
// contains filtered or unexported fields
}
Toggle is the pressed-state button: an icon or label that stays filled while On. State lives on the struct; clicking flips it.
func (*Toggle) Layout ¶
func (t *Toggle) Layout(th *Theme, gtx layout.Context, o ToggleProps) layout.Dimensions
type ToggleGroup ¶
type ToggleGroup struct {
Options []ToggleOption
Multiple bool
// Outline borders every off item; Disabled dims the whole group;
// Vertical stacks instead of rowing; Spacing overrides the 2dp
// gap between items.
Outline bool
Disabled bool
Vertical bool
Spacing unit.Dp
// contains filtered or unexported fields
}
ToggleGroup coordinates a row of toggles over a shared Option list: single-select by default (radio semantics — clicking the selected item clears it), or independent choices with Multiple. Selection is read and written as VALUES; the cursor and the per-option bools are unexported, because a position in this list is not something an app should store.
view := lotusui.ToggleGroup{Options: lotusui.ToggleOpts("All", "Missed"), Outline: true}
view.SetValue(stored)
view.Layout(th, gtx, lotusui.SizeMD)
stored = view.Value()
marks := lotusui.ToggleGroup{Multiple: true, Options: []lotusui.ToggleOption{
{Label: "Bold", Value: "bold", Icon: lotusui.IconTextBold},
{Label: "Italic", Value: "italic", Icon: lotusui.IconTextItalic},
}}
marks.SetValues([]string{"bold"})
active := marks.Values() // in Options order
func (*ToggleGroup) Chosen ¶ added in v0.2.0
func (g *ToggleGroup) Chosen() bool
Chosen reports whether anything is selected.
func (*ToggleGroup) Clear ¶ added in v0.2.0
func (g *ToggleGroup) Clear()
Clear leaves nothing selected, in either mode.
func (*ToggleGroup) Layout ¶
func (g *ToggleGroup) Layout(th *Theme, gtx layout.Context, size Size) layout.Dimensions
func (*ToggleGroup) SetValue ¶ added in v0.2.0
func (g *ToggleGroup) SetValue(v string)
SetValue selects the option carrying v (single-select). An unknown value selects nothing rather than falling back to the first option.
func (*ToggleGroup) SetValues ¶ added in v0.2.0
func (g *ToggleGroup) SetValues(vs []string)
SetValues selects exactly the options carrying vs (multi-select); unknown values are ignored. In single-select mode the first recognised value wins.
func (*ToggleGroup) Value ¶ added in v0.2.0
func (g *ToggleGroup) Value() string
Value is the selected option's value in single-select mode ("" when nothing is selected, and always "" when Multiple is set — use Values there).
func (*ToggleGroup) Values ¶ added in v0.2.0
func (g *ToggleGroup) Values() []string
Values are the selected options' values in Options order — one entry at most in single-select mode.
type ToggleOption ¶ added in v0.2.0
ToggleOption is one toggle of a group — the choice contract lives with SelectOption. Icon renders before the label; Content replaces both with arbitrary content inside the toggle's chrome.
func ToggleOpts ¶
func ToggleOpts(labels ...string) []ToggleOption
ToggleOpts builds label-only toggle options — the shorthand when the label IS the datum. SelectOpts, RadioOpts and TabOpts are its siblings.
func (ToggleOption) Val ¶ added in v0.2.0
func (o ToggleOption) Val() string
Val is the option's stored value — its Label when Value is empty.
type ToggleProps ¶ added in v0.3.0
type ToggleProps struct {
Icon string
Label string
// Content replaces Icon/Label with arbitrary content inside the
// toggle's chrome.
Content layout.Widget
Size Size
Outline bool // bordered when off
Disabled bool
}
ToggleProps are the toggle's options — an Icon, a Label, or both.
type Tooltip ¶
type Tooltip struct {
// Side positions the label; bottom is the default.
Side TooltipSide
// contains filtered or unexported fields
}
type TooltipSide ¶
type TooltipSide int
Tooltip attaches a hover label to any widget: hold the pointer over the child for a beat and the label floats in beneath it, inverted chrome (dark surface, light ink). The pointer area PASSES events through — the child keeps its own interactions.
Layout may be called multiple times per frame on the same Tooltip; each call is a distinct site and only the hovered site paints.
TooltipSide selects where the label floats relative to the child.
const ( TooltipBottom TooltipSide = iota TooltipTop TooltipLeft TooltipRight )
type VSlide ¶
type VSlide struct {
// contains filtered or unexported fields
}
VSlide is Split's VERTICAL sibling, for full-screen pivots (the expanded item view): two REAL screens, the over-screen sliding up from the bottom while the base screen is pushed up and away — the same grammar as the horizontal strip, turned 90°. Settled, only the visible screen is laid out at all. Mid-flight, both screens are laid out with their normal settled constraints but a DISABLED input context — hover pills, carets, anything input-dependent is uniformly off — and their recorded frames are merely translated inside an overflow-hidden viewport: verbatim pixels sliding, so the moving content can never reflow, compress, or flicker.
Source Files
¶
- accordion.go
- alert.go
- alertdialog.go
- anim.go
- avatar.go
- badge.go
- breadcrumb.go
- breakpoints.go
- button.go
- buttongroup.go
- card.go
- checkbox.go
- components.go
- dialog.go
- field.go
- floating.go
- glossary.go
- grid.go
- hovercard.go
- icons_gen.go
- iconsvg.go
- inputotp.go
- inputs.go
- kbd.go
- listview.go
- menu.go
- openurl.go
- openurl_unix.go
- pagination.go
- popover.go
- progress.go
- radio.go
- scales.go
- scales_gen.go
- select.go
- separator.go
- skeleton.go
- slider.go
- spinner.go
- split.go
- split_scroll.go
- stack.go
- switch.go
- table.go
- tabs.go
- textarea.go
- theme.go
- toast.go
- toggle.go
- tooltip.go
- version.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
lotusui
command
Command lotusui is the library's developer CLI.
|
Command lotusui is the library's developer CLI. |
|
registry
|
|
|
blocks/login
Package login is the login-form block: a ready-made composition of Card, Field, Input and Button — vendor it with `lotusui add login-form` and shape it to your app.
|
Package login is the login-form block: a ready-made composition of Card, Field, Input and Button — vendor it with `lotusui add login-form` and shape it to your app. |