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/sections.html#the-nav-element"><nav></a> 023 * element. 024 * 025 * <p> 026 * The nav element represents a section of a page that links to other pages or to parts within 027 * the same page. It is used to contain navigation links and is typically used for site navigation, 028 * table of contents, or pagination. The nav element should contain a list of links and is important 029 * for accessibility as it helps screen readers identify the main navigation areas of a page. 030 * It is commonly used with ul and li elements to create structured navigation menus. 031 * 032 * <h5 class='section'>Examples:</h5> 033 * <p class='bcode w800'> 034 * <jc>// Simple navigation</jc> 035 * Nav <jv>simple</jv> = <jsm>nav</jsm>( 036 * <jsm>ul</jsm>( 037 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/home"</js>, <js>"Home"</js>)), 038 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/about"</js>, <js>"About"</js>)), 039 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/contact"</js>, <js>"Contact"</js>)) 040 * ) 041 * ); 042 * 043 * <jc>// Nav with styling</jc> 044 * Nav <jv>styled</jv> = <jsm>nav</jsm>( 045 * <jsm>ul</jsm>( 046 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/products"</js>, <js>"Products"</js>)), 047 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/services"</js>, <js>"Services"</js>)), 048 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/support"</js>, <js>"Support"</js>)) 049 * ) 050 * ).class_(<js>"main-navigation"</js>); 051 * 052 * <jc>// Nav with complex content</jc> 053 * Nav <jv>complex</jv> = <jsm>nav</jsm>( 054 * <jsm>h3</jsm>(<js>"Site Navigation"</js>), 055 * <jsm>ul</jsm>( 056 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/home"</js>, <js>"Home"</js>)), 057 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/about"</js>, <js>"About"</js>)), 058 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/contact"</js>, <js>"Contact"</js>)) 059 * ) 060 * ); 061 * 062 * <jc>// Nav with ID</jc> 063 * Nav <jv>withId</jv> = <jsm>nav</jsm>( 064 * <jsm>ul</jsm>( 065 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/home"</js>, <js>"Home"</js>)), 066 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/about"</js>, <js>"About"</js>)) 067 * ) 068 * ).id(<js>"main-nav"</js>); 069 * 070 * <jc>// Nav with styling</jc> 071 * Nav <jv>styled2</jv> = <jsm>nav</jsm>( 072 * <jsm>ul</jsm>( 073 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/home"</js>, <js>"Home"</js>)), 074 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/about"</js>, <js>"About"</js>)) 075 * ) 076 * ).style(<js>"background-color: #333; padding: 10px;"</js>); 077 * 078 * <jc>// Nav with multiple elements</jc> 079 * Nav <jv>multiple</jv> = <jsm>nav</jsm>( 080 * <jsm>h3</jsm>(<js>"Navigation"</js>), 081 * <jsm>ul</jsm>( 082 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/home"</js>, <js>"Home"</js>)), 083 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/about"</js>, <js>"About"</js>)) 084 * ), 085 * <jsm>p</jsm>(<js>"Use the links above to navigate the site."</js>) 086 * ); 087 * 088 * <jc>// Nav with breadcrumbs</jc> 089 * Nav <jv>breadcrumbs</jv> = <jsm>nav</jsm>( 090 * <jsm>ul</jsm>( 091 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/"</js>, <js>"Home"</js>)), 092 * <jsm>li</jsm>(<js>" > "</js>), 093 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/products"</js>, <js>"Products"</js>)), 094 * <jsm>li</jsm>(<js>" > "</js>), 095 * <jsm>li</jsm>(<js>"Current Page"</js>) 096 * ) 097 * ); 098 * </p> 099 * 100 * <p> 101 * The following convenience methods are provided for constructing instances of this bean: 102 * <ul class='javatree'> 103 * <li class='jc'>{@link HtmlBuilder} 104 * <ul class='javatree'> 105 * <li class='jm'>{@link HtmlBuilder#nav() nav()} 106 * <li class='jm'>{@link HtmlBuilder#nav(Object...) nav(Object...)} 107 * </ul> 108 * </ul> 109 * </p> 110 * 111 * <h5 class='section'>See Also:</h5><ul> 112 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 113 * </ul> 114 */ 115@Marshalled(typeName = "nav") 116public class Nav extends HtmlElementMixed<Nav> { 117 118 /** 119 * Creates an empty {@link Nav} element. 120 */ 121 public Nav() {} 122 123 /** 124 * Creates a {@link Nav} element with the specified child nodes. 125 * 126 * @param children The child nodes. 127 */ 128 public Nav(Object...children) { 129 children(children); 130 } 131 132}