Tobago provides several ways to select an option. Entries are added with <tc:selectItem/> or <tc:selectItems value="#{controller.list}"/> for most select components.
<tc:selectItem/>
<tc:selectItems value="#{controller.list}"/>
<tc:selectBooleanCheckbox label="Checkbox"/>
<tc:selectBooleanToggle label="Toggle"/>
<tc:selectOneChoice label="Dropdown Box">
<tc:selectOneRadio label="Radio Group" labelLayout="top">
<tc:selectOneListbox label="Listbox" size="3">
<tc:selectManyCheckbox label="Checkbox Group" labelLayout="top">
<tc:selectManyListbox label="List" size="3">
<tc:selectManyShuttle label="Shuttle List" size="7">
<?xml version="1.0" encoding="UTF-8"?> <!-- * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. --> <ui:composition template="/main.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:tc="http://myfaces.apache.org/tobago/component" xmlns:ui="http://java.sun.com/jsf/facelets"> <ui:param name="title" value="#{demoBundle.select}"/> <p>Tobago provides several ways to select an option. Entries are added with <code class="language-markup"><tc:selectItem/></code> or <code class="language-markup"><tc:selectItems value="\#{controller.list}"/></code> for most select components.</p> <tc:section label="#{demoBundle.selectBooleanCheckbox}"> <pre><code class="language-markup"><tc:selectBooleanCheckbox label="Checkbox"/></code></pre> <tc:selectBooleanCheckbox label="Checkbox" itemLabel="OK?"/> </tc:section> <tc:section label="#{demoBundle.selectBooleanToggle}"> <pre><code class="language-markup"><tc:selectBooleanToggle label="Toggle"/></code></pre> <tc:selectBooleanToggle label="Toggle" itemLabel="Active"/> </tc:section> <tc:section label="#{demoBundle.selectOneChoice}"> <pre><code class="language-markup"><tc:selectOneChoice label="Dropdown Box"></code></pre> <tc:selectOneChoice label="Dropdown Box"> <tc:selectItems value="#{selectController.entries}"/> </tc:selectOneChoice> </tc:section> <tc:section label="#{demoBundle.selectOneRadio}"> <pre><code class="language-markup"><tc:selectOneRadio label="Radio Group" labelLayout="top"></code></pre> <tc:selectOneRadio id="radio" label="Radio Group" labelLayout="top"> <tc:selectItem itemLabel="Option One"/> <tc:selectItem itemLabel="Option Two"/> </tc:selectOneRadio> </tc:section> <tc:section label="#{demoBundle.selectOneListbox}"> <pre><code class="language-markup"><tc:selectOneListbox label="Listbox" size="3"></code></pre> <tc:selectOneListbox label="Listbox" size="3"> <tc:selectItems value="#{selectController.entries}"/> </tc:selectOneListbox> </tc:section> <tc:section label="#{demoBundle.selectManyCheckbox}"> <pre><code class="language-markup"><tc:selectManyCheckbox label="Checkbox Group" labelLayout="top"></code></pre> <tc:selectManyCheckbox label="Checkbox Group" labelLayout="top"> <tc:selectItem itemLabel="Checkbox One"/> <tc:selectItem itemLabel="Checkbox Two"/> </tc:selectManyCheckbox> </tc:section> <tc:section label="#{demoBundle.selectManyListbox}"> <pre><code class="language-markup"><tc:selectManyListbox label="List" size="3"></code></pre> <tc:selectManyListbox label="List" size="3"> <tc:selectItems value="#{selectController.entries}"/> </tc:selectManyListbox> </tc:section> <tc:section label="#{demoBundle.selectManyShuttle}"> <pre><code class="language-markup"><tc:selectManyShuttle label="Shuttle List" size="7"></code></pre> <tc:selectManyShuttle label="Shuttle List" size="7"> <tc:selectItems value="#{selectController.entries}"/> </tc:selectManyShuttle> </tc:section> </ui:composition>