Navbar

v0.0.10

v0.0.10StableComponentStatelessJS-moduleApache-2.0
Installation mix mishka.ui.gen.component navbar
Source View Source

Overview of the Phoenix LiveView Navbar Component

The Mishka Navbar component is a Phoenix LiveView component that enables developers to create fully customizable and responsive navigation bars, perfect for enhancing user engagement. It offers flexible design options, allowing for adjustments in color, layout, and alignment, ensuring a seamless and professional appearance.

Overview of the Phoenix LiveView Navbar Component

This Phoenix LiveView component supports multiple design variants such as default, shadow, and bordered, making it ideal for improving both the aesthetic and functionality of your application's navigation. With its responsive design and ease of customization, this navbar component enhances the usability and accessibility of your website's interface.

Base Color & Variant

Base Color & Variant

heex
<.navbar id="navbar-1">
  <:start_content>
    <.link
      navigate="/path"
      class="flex items-center space-x-3 rtl:space-x-reverse mb-5 md:mb-0"
    >
      <img src="/path" class="hidden dark:block size-10" alt="" />
      <img src="/path" class="dark:hidden size-10" alt="" />
      <div class="text-xl font-semibold">
        Mishka
      </div>
    </.link>
  </:start_content>
  <:list><.link title="Mishak" navigate="/">Mishka</.link></:list>

  <:list><.link title="Mishak chelekom" navigate="/chelekom">Chelekom</.link></:list>

  <:list><.link title="Mishak blog" navigate="/blog">Blog</.link></:list>

  <:list><.link navigate="/chelekom/docs">Docs</.link></:list>
</.navbar>

Default Variant

The default style of the Mishka Chelekom navbar applies a solid background and border that change based on user interaction, making it perfect for delivering important notifications. With just a single setting, you can select from a range of color options, ensuring easy customization to match various design styles. Default variant have also white and dark colors which are the same colors in the dark and light mode.

heex
<.navbar id="navbar-2" variant="default" color="natural"></.navbar>
<.navbar id="navbar-3" variant="default" color="white"></.navbar>
<.navbar id="navbar-4" variant="default" color="primary"></.navbar>
<.navbar id="navbar-5" variant="default" color="secondary"></.navbar>
<.navbar id="navbar-6" variant="default" color="dark"></.navbar>
<.navbar id="navbar-7" variant="default" color="success"></.navbar>
<.navbar id="navbar-8" variant="default" color="warning"></.navbar>
<.navbar id="navbar-9" variant="default" color="danger"></.navbar>
<.navbar id="navbar-10" variant="default" color="info"></.navbar>
<.navbar id="navbar-11" variant="default" color="silver"></.navbar>
<.navbar id="navbar-12" variant="default" color="misc"></.navbar>
<.navbar id="navbar-13" variant="default" color="dawn"></.navbar>

Shadow Variant

The shadow variant of the Mishka Chelekom navbar is similar to the default variant, but it also includes a subtle shadow along with a border and white background in light mode.

heex
<.navbar id="navbar-14" color="natural" variant="shadow"></.navbar>
<.navbar id="navbar-15" color="primary" variant="shadow"></.navbar>
<.navbar id="navbar-16" color="secondary" variant="shadow"></.navbar>
<.navbar id="navbar-17" color="success" variant="shadow"></.navbar>
<.navbar id="navbar-18" color="warning" variant="shadow"></.navbar>
<.navbar id="navbar-19" color="danger" variant="shadow"></.navbar>
<.navbar id="navbar-20" color="info" variant="shadow"></.navbar>
<.navbar id="navbar-21" color="silver" variant="shadow"></.navbar>
<.navbar id="navbar-22" color="misc" variant="shadow"></.navbar>
<.navbar id="navbar-23" color="dawn" variant="shadow"></.navbar>

bordered Variant

The Bordered variant of the Mishka Chelekom navbar has lighter background and a border. Bordered variant have also white and dark colors which are the same colors in the dark and light mode.

heex
<.navbar id="navbar-24" color="natural" variant="bordered"></.navbar>
<.navbar id="navbar-25" color="white" variant="bordered"></.navbar>
<.navbar id="navbar-26" color="primary" variant="bordered"></.navbar>
<.navbar id="navbar-27" color="secondary" variant="bordered"></.navbar>
<.navbar id="navbar-28" color="dark" variant="bordered"></.navbar>
<.navbar id="navbar-29" color="success" variant="bordered"></.navbar>
<.navbar id="navbar-30" color="warning" variant="bordered"></.navbar>
<.navbar id="navbar-31" color="danger" variant="bordered"></.navbar>
<.navbar id="navbar-32" color="info" variant="bordered"></.navbar>
<.navbar id="navbar-33" color="silver" variant="bordered"></.navbar>
<.navbar id="navbar-34" color="misc" variant="bordered"></.navbar>
<.navbar id="navbar-35" color="dawn" variant="bordered"></.navbar>

gradient Variant

The gradient variant of the Mishka Chelekom navbar has gradients in various colors.

heex
<.navbar id="navbar-36" color="natural" variant="bordered"></.navbar>
<.navbar id="navbar-37" color="white" variant="bordered"></.navbar>
<.navbar id="navbar-38" color="primary" variant="bordered"></.navbar>
<.navbar id="navbar-39" color="secondary" variant="bordered"></.navbar>
<.navbar id="navbar-40" color="dark" variant="bordered"></.navbar>
<.navbar id="navbar-41" color="success" variant="bordered"></.navbar>
<.navbar id="navbar-42" color="warning" variant="bordered"></.navbar>
<.navbar id="navbar-43" color="danger" variant="bordered"></.navbar>
<.navbar id="navbar-44" color="info" variant="bordered"></.navbar>
<.navbar id="navbar-45" color="silver" variant="bordered"></.navbar>
<.navbar id="navbar-46" color="misc" variant="bordered"></.navbar>
<.navbar id="navbar-47" color="dawn" variant="bordered"></.navbar>

Rounded prop of Phoenix LiveView navbar Component

The rounded prop offers values like extra_small, small, medium, large, and extra_large. These values control the border radius of the navbar, allowing for different levels of rounding from subtle to more pronounced corners, depending on the design needs.

Rounded prop of Phoenix LiveView navbar Component

heex
<.navbar id="navbar-48" rounded="extra_small"></.navbar>
<.navbar id="navbar-49" rounded="small"></.navbar>
<.navbar id="navbar-50" rounded="medium"></.navbar>
<.navbar id="navbar-51" rounded="large"></.navbar>
<.navbar id="navbar-52" rounded="extra_large"></.navbar>

Border prop

The border prop offers values like extra_small, small, medium, large, and extra_large. These values control the border size of the navbars, allowing you to adjust the thickness to suit your design.

heex
<.navbar id="navbar-53" border="extra_small"></.navbar>
<.navbar id="navbar-54" border="small"></.navbar>
<.navbar id="navbar-55" border="medium"></.navbar>
<.navbar id="navbar-56" border="large"></.navbar>
<.navbar id="navbar-57" border="extra_large"></.navbar>

Padding prop

The padding prop offers values such as extra_small, small, medium, large, and extra_large. These values control the padding around the content inside the navbars.

Padding prop

heex
<.navbar id="navbar-58" padding="extra_small"></.navbar>
<.navbar id="navbar-59" padding="small"></.navbar>
<.navbar id="navbar-60" padding="medium"></.navbar>
<.navbar id="navbar-61" padding="large"></.navbar>
<.navbar id="navbar-62" padding="extra_large"></.navbar>

Max width prop

The max_width attribute controls the maximum width of the navbar component, ensuring that the content stays within a defined boundary, which is especially useful for creating consistent layouts. By setting the max_width value, you can easily limit how wide the navbar can extend, maintaining a structured appearance across different screen sizes. This attribute allows the navbar to remain centered and visually balanced, enhancing the overall presentation of the component in any layout.

Max width prop

heex
<.navbar id="navbar-63" max_width="extra_small"></.navbar>
<.navbar id="navbar-64" max_width="small"></.navbar>
<.navbar id="navbar-65" max_width="medium"></.navbar>
<.navbar id="navbar-66" max_width="large"></.navbar>
<.navbar id="navbar-67" max_width="extra_large"></.navbar>

Text position prop

The text_position attribute controls the alignment of text within a component, ensuring that content is properly positioned based on the design needs. With options like left, right, and center, you can align text to the left, right, or center of the component, respectively. This flexibility allows developers to manage how textual content is presented, enhancing readability and improving the visual structure of the component. If no specific value is provided, a default alignment is applied, typically aligning the text to the left.

Text position prop

heex
<.navbar id="navbar-68" text_position="left"></.navbar>
<.navbar id="navbar-69" text_position="center"></.navbar>
<.navbar id="navbar-70" text_position="right"></.navbar>

Logo in navbar component of Phoenix LiveView

By using the image prop, you can add your logo at the start position of the navbar, ensuring it grabs users' attention right away. With the image_class prop, you can apply custom styles to your logo, tailoring its appearance to fit your brand. Additionally, including a link is essential to make the logo interactive, allowing users to navigate back to the homepage or another specified page when they click on it.

Logo in navbar component of Phoenix LiveView

heex
<.navbar id="navbar-75" link="/" image="/path" image_class="your_classes"></.navbar>

Content position prop

The content_position prop controls the horizontal alignment of content within the navbar by applying different justify-content classes to the wrapper. It accepts values like start, end, center, between, and around to distribute the content accordingly. The default value is between, which creates equal spacing between elements.

Content position prop

heex
<.navbar id="navbar-82" content_position="center">
  Mishka Chelekom Library
</.navbar>