diff --git a/examples/burger/main.go b/examples/burger/main.go index e2bb93a5..e337376e 100644 --- a/examples/burger/main.go +++ b/examples/burger/main.go @@ -59,7 +59,10 @@ func main() { form := huh.NewForm( huh.NewGroup(huh.NewNote(). Title("Charmburger"). - Description("Welcome to _Charmburgerâ„¢_.\n\nHow may we take your order?")), + Description("Welcome to _Charmburgerâ„¢_.\n\nHow may we take your order?\n\n"). + Next(true). + WithNextLabel("Let's go!"), + ), // Choose a burger. // We'll need to know what topping to add too. diff --git a/field_note.go b/field_note.go index 43bdd36c..f532f5dc 100644 --- a/field_note.go +++ b/field_note.go @@ -25,6 +25,7 @@ type Note struct { accessible bool theme *Theme keymap NoteKeyMap + nextLabel string } // NewNote creates a new note field. @@ -32,6 +33,7 @@ func NewNote() *Note { return &Note{ showNextButton: false, skip: true, + nextLabel: "Next", } } @@ -131,7 +133,7 @@ func (n *Note) View() string { sb.WriteString(render(n.description)) } if n.showNextButton { - sb.WriteString(styles.Next.Render("Next")) + sb.WriteString(styles.Next.Render(n.nextLabel)) } return styles.Card.Render(sb.String()) } @@ -205,6 +207,12 @@ func (n *Note) WithPosition(p FieldPosition) Field { return n } +// WithNextLabel sets the next button label. +func (n *Note) WithNextLabel(label string) Field { + n.nextLabel = label + return n +} + // GetValue satisfies the Field interface, notes do not have values. func (n *Note) GetValue() any { return nil