Home
Wiki
Home
Wiki
  1. Components
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
  1. Components

Top Bar

Top Bar Component Documentation#

Overview#

The Top Bar component is a component that displays a notification bar at the top of a webpage. This bar can be used to show important messages, announcements, or alerts in a prominent position. The component includes text that can be customized, and it allows for optional styling through CSS classes.

Model Documentation#

Model Structure#

The Top Bar component relies on a model structure that includes the following properties:
id: A unique identifier for the top bar section.
cssClass: Additional CSS classes for styling the top bar.
text: The HTML content to be displayed within the top bar.

Example Model#

Here’s an example of how the model might be structured:

Component Structure#

The Top Bar component consists of the following key sections:
1.
HTML Template: Defines the structure and layout of the top bar.
2.
JavaScript: Handles the component's logic, including showing and hiding the top bar.
3.
Data: Contains the showTopBar state, which controls the visibility of the top bar.
4.
Methods: Includes a method to toggle the visibility of the top bar.

HTML Template#

The HTML template describes how the top bar is structured. It includes the bar container and the text content.

Explanation of HTML Elements:#

div (Top Bar Container): This div wraps the entire top bar. The v-if directive controls its visibility based on the showTopBar state.
id: The id attribute is dynamically set based on the model's id.
cssClass: Additional CSS classes are dynamically applied using :class binding to style the top bar.
v-html: This directive is used to render the HTML content specified in the text property of the model.

JavaScript#

The JavaScript section handles the logic for the Top Bar component, including toggling its visibility.

Component Definition#

Explanation of JavaScript Code:#

Props: The component accepts a model object that contains the content and styling information for the top bar.
Data: The data() function initializes the showTopBar property, which controls whether the top bar is visible.
Methods:
hide(): This method toggles the visibility of the top bar by updating the showTopBar state.

Usage#

To use the Top Bar component, include it in your Vue application and provide the appropriate model data.
Modified at 2024-08-27 12:15:34
Previous
Text with Image
Next
Video
Built with