Skip to content

Yes or no choice

This component prompts the user to answer a yes or no question.

PropertyValue
InteractivityRequired (fails otherwise)

Demo

A gif that shows the component in action. The developer uses the key strokes left and right to change their answer from yes to no

API

Example

swift
Noora().yesOrNoChoicePrompt(
  title: "Authentication",
  question: "Would you like to authenticate?",
  defaultAnswer: true,
  description: "Authentication is required to use some CLI features."
)

Options

AttributeDescriptionRequiredDefault value
titleThe title of the prompt.No
questionThe question that the user will answer.Yes
defaultAnswerThe default answer.Notrue
descriptionA description that provides more context about the question.No
collapseOnSelectionWhether the prompt should collapse after the user selects an option.Notrue

Released under the MIT License.