001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bean.html5;
018
019import org.apache.juneau.marshall.*;
020
021/**
022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#the-legend-element">&lt;legend&gt;</a>
023 * element.
024 *
025 * <p>
026 * The legend element represents a caption for the content of its parent fieldset element.
027 * It is used to provide a title or description for a group of form controls that are
028 * contained within a fieldset. The legend element should be placed as the first child
029 * of a fieldset element and is typically rendered above or to the side of the fieldset
030 * content, often with special styling to distinguish it from the form controls.
031 *
032 * <h5 class='section'>Examples:</h5>
033 * <p class='bcode w800'>
034 *    <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*;
035 *
036 *    <jc>// Simple legend</jc>
037 *    Legend <jv>simple</jv> = <jsm>legend</jsm>(<js>"Personal Information"</js>);
038 *
039 *    <jc>// Legend with styling</jc>
040 *    Legend <jv>styled</jv> = <jsm>legend</jsm>(<js>"Contact Details"</js>)
041 *       .class_(<js>"form-legend"</js>);
042 *
043 *    <jc>// Legend with complex content</jc>
044 *    Legend <jv>complex</jv> = <jsm>legend</jsm>(
045 *       <js>"Step 1: "</js>,
046 *       <jsm>strong</jsm>(<js>"Basic Information"</js>),
047 *       <js>" "</js>,
048 *       <jsm>em</jsm>(<js>"(Required)"</js>)
049 *    );
050 *
051 *    <jc>// Legend with ID</jc>
052 *    Legend <jv>withId</jv> = <jsm>legend</jsm>(<js>"Form Legend"</js>)
053 *       .id(<js>"form-legend"</js>);
054 *
055 *    <jc>// Legend with styling</jc>
056 *    Legend <jv>styled2</jv> = <jsm>legend</jsm>(<js>"Styled Legend"</js>)
057 *       .style(<js>"color: #333; font-weight: bold; padding: 0 10px;"</js>);
058 *
059 *    <jc>// Legend with multiple elements</jc>
060 *    Legend <jv>multiple</jv> = <jsm>legend</jsm>(
061 *       <js>"Section 1: "</js>,
062 *       <jsm>span</jsm>(<js>"User Details"</js>).class_(<js>"section-title"</js>),
063 *       <js>" "</js>,
064 *       <jsm>small</jsm>(<js>"(All fields required)"</js>)
065 *    );
066 *
067 *    <jc>// Legend with links</jc>
068 *    Legend <jv>withLinks</jv> = <jsm>legend</jsm>(
069 *       <js>"Help: "</js>,
070 *       <jsm>a</jsm>(<js>"/help/forms"</js>, <js>"Form Guide"</js>)
071 *    );
072 * </p>
073 *
074 * <p>
075 * The following convenience methods are provided for constructing instances of this bean:
076 * <ul class='javatree'>
077 *    <li class='jc'>{@link HtmlBuilder}
078 *    <ul class='javatree'>
079 *       <li class='jm'>{@link HtmlBuilder#legend() legend()}
080 *       <li class='jm'>{@link HtmlBuilder#legend(Object...) legend(Object...)}
081 *    </ul>
082 * </ul>
083 * </p>
084 *
085 * <h5 class='section'>See Also:</h5><ul>
086 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a>
087 * </ul>
088 */
089@Marshalled(typeName = "legend")
090public class Legend extends HtmlElementMixed<Legend> {
091
092   /**
093    * Creates an empty {@link Legend} element.
094    */
095   public Legend() {}
096
097   /**
098    * Creates a {@link Legend} element with the specified child nodes.
099    *
100    * @param children The child nodes. Must not be <jk>null</jk>.
101    */
102   public Legend(Object...children) {
103      children(children);
104   }
105
106}