Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶ added in v0.0.12
Button is one answer a dialog offers.
Accel is the single key that chooses it outright, drawn inside the label so it is discoverable before it is needed (decision I-7). It is not a held key — that is why y/n are safe here and j/k are not. The reason j/k were kept off the button row is that they are what a reader's fingers are already on when a confirm appears mid-scroll; an accelerator letter nobody is holding cannot be pressed by reflex.
Affirmative is what Confirmed reports for this button. Every button that does the thing is affirmative; the one that backs out is not.
type DialogResultMsg ¶
DialogResultMsg is emitted when a dialog is closed.
Value names the button that was chosen, so a dialog with more than two answers can be told apart by the host: the delete confirm asks "for me" or "for everyone", and the caller has to know which. Confirmed remains the yes/no reading of the same answer — true for any button that acts, false for the one that backs out and for Escape — so the callers that only ever asked one question did not have to learn a second vocabulary.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is a modal dialog component.
func NewChoice ¶ added in v0.0.12
NewChoice creates a dialog with an arbitrary set of answers.
The first button is the highlighted one, and it must be the one that backs out: Enter accepts whatever is highlighted, so a reflex Enter has to be harmless. NewConfirm and NewAlert are the two shapes that existed before this and are now wrappers, so there is one implementation of the button row, the accelerators and the hint line rather than one per shape.
func NewConfirm ¶
NewConfirm creates a two-button confirmation dialog, answerable with y and n as well as with the arrows (decision I-7).