BuckshotPlusPlus
  • 🤝Getting started
    • What is BuckShotPlusPlus?
    • Install
  • 📺Video tutorials
    • Getting started with bpp
    • How to use reusable components
    • How to use events
  • 👔Data types
    • Variables
    • Arrays
    • View
    • Data
    • Page
    • Event
  • 🤓The basics
    • Comments
    • Include
    • String concatenation
    • Conditions
    • Sessions
    • Static site export
  • 🔍SEO
    • Sitemap.xml
    • Meta tags
  • Advanced use
    • CSS Properties
Powered by GitBook
On this page
  • How it works
  • Declaring views
  • Child views and inheritance
  • Use cases
  • Important notes

Was this helpful?

Export as PDF
  1. Data types

View

PreviousArraysNextData

Last updated 1 year ago

Was this helpful?

Views are central to . They represent the visual elements of your application and can contain properties related to HTML, CSS, and JS. The power of views in lies in their reusability and the ability to define relationships between them.

How it works

Declaring views

In , you can declare a using the view keyword followed by the name of the view and its properties enclosed in curly braces. Each property of the view defines a specific aspect of its appearance or behavior.

Here's a basic example:

view MyFirstView{
    type = "h1"
    content = "This is an awesome title!"
    color = "red"
}

In this example, a view named MyFirstView is declared with three properties: type, content, and color.

Child views and inheritance

is an , which means you can create child views that inherit properties from a parent view. When a child view is declared based on a parent view, it inherits all the properties of the parent. However, you can override any inherited property in the child view.

Here's an example:

view MyChildView:MyFirstView{
    content = "I have just changed the content of MyFirstView !"
}

In this example, MyChildView is a child of MyFirstView and inherits all its properties. The content property is then overridden in the child view.

Use cases

  1. Modular Design: By using views, you can create modular and reusable components for your application, ensuring consistency and reducing redundancy.

  2. Dynamic Content: Views can be used to dynamically render content based on user interactions or other conditions.

  3. Hierarchical Structure: With the inheritance feature, you can establish a hierarchical structure for your views, making it easier to manage and update them.

Important notes

  • Always give descriptive names to your views to make your code more readable.

  • Use inheritance wisely to avoid complications and ensure a clear relationship between parent and child views.

  • Test your views in various scenarios to ensure they render correctly and behave as expected.

👔
BuckshotPlusPlus
BuckshotPlusPlus
BuckshotPlusPlus
view
BuckshotPlusPlus
Object-Oriented language