multiselect

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package multiselect renders a checkbox-group inside a disclosure with chip rendering of the selected values above the trigger.

Output structure:

<div data-fui-comp="ui-multiselect">
  <div class="ui-multiselect__chips" data-fui-multiselect-chips>
    <!-- runtime fills with chips for each :checked option -->
  </div>
  <details class="ui-multiselect__disclosure">
    <summary>Pick languages…</summary>
    <fieldset role="group">
      <label><input type="checkbox" name="…" value="…"> Go</label>
      …
    </fieldset>
  </details>
</div>

Server gets standard checkbox-group submission semantics (Name repeats for each checked option). No RPC dance — apps that need server-fetched options should compose this with a partial render.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(cfg Config) render.HTML

Render renders the MultiSelect.

Types

type Config

type Config struct {
	// Name is the form-field name (required). All checkboxes share
	// this name; the form receives the repeated key for each checked
	// option.
	Name string
	// Label is the accessible label (required).
	Label string
	// Placeholder is the disclosure-summary text shown when no
	// options are selected. Defaults to "Choose…".
	Placeholder string
	// Options are the choices (≥1).
	Options []Option
	// Open opts the disclosure into rendering open by default.
	Open bool
	// ID / Class / Attrs are passed through to the wrapper.
	ID         string
	Class      string
	ExtraAttrs html.Attrs
}

Config configures a MultiSelect.

type Option

type Option struct {
	Value    string // form-submit value (required)
	Label    string // visible label (required)
	Selected bool   // initial checked state
	Disabled bool
}

Option is a single checkbox option.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL