selection multiple buttons

struct Question {
 var title: String
 var options : [String]
  }

 struct SimpleQuestions: View  {

 @State var selectedOption = ""

@State var question = Question(title: "question title", options: \["one", "two", "three"\])

var body: some View {
 VStack {
       Text(question.title)
     ForEach(question.options, id: \.self) { option in 
        HStack {
             Button {
           selectedOption = option
            } label: {
                Circle()
                .foregroundStyle(selectedOption == option ? .blue :                     .gray.opacity(0.5))
                .frame(width: 23, height: 23)
 }}}}}

Hi @kocaman,

I'm not sure I understand what you want to do, could you provide more details please?

The only thing I can see is that you put the HStack inside of the ForEach, which leads to the creation of different HStack for each button option instance.

Sorry, is there a question here?

selection multiple buttons
 
 
Q