SelectOneButton is used to choose a single item from a list using buttons.
<div class="card">
<h:form>
<p:selectOneButton value="#{selectOneButtonView.option}">
<f:selectItem itemLabel="Option1" itemValue="Option1"/>
<f:selectItem itemLabel="Option2" itemValue="Option2"/>
<f:selectItem itemLabel="Option3" itemValue="Option3"/>
</p:selectOneButton>
</h:form>
</div>
package org.primefaces.showcase.view.input;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;
import io.quarkus.runtime.annotations.RegisterForReflection;
@Named
@RequestScoped
@RegisterForReflection(serialization = true)
public class SelectOneButtonView {
private String option;
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
}