Collection of web components (UI components) meant to be used, but not limited to, BIM applications.
npm install @thatopen/ui
TOC
|
Documentation
|
Demo
|
Community
|
NPM Package
core.Now, from the @thatopen/ui you can't expect to have functionalities in your components. In other words, if you need a button component to load an IFC file from @thatopen/components you will need to code that by yourself 🙁. However, as the goal of the library is to save you as much time as possible, we've created implementations of the components based on things we know you're probably going to need at some point 💪. Here is were it comes the other repository in the monorepo.
Think on the following repository as plug-n-play functional components that uses the core library to build ready to go pieces of UI with the functionalities to work nice and neat:
* @thatopen/ui-obc: Here you will find pre-made functional components for many things in @thatopen/components (the entry point of That Open Engine). You can expect to have from a button that loads an IFC file, to a table to configure your app tools or a panel to view all your model classifications. Basically, @thatopen/components gives you the functionality, while @thatopen/ui-obc gives you the UI to interact with those functionalities.
> [!IMPORTANT]
> All the implementation libraries need @thatopen/ui to be installed along with the respective packages they are giving UIs to. See the respective package.json files in each repository.
@thatopen/ui-obc in the core library, you will always need to have @thatopen/components and @thatopen/components-front installed in your project even tough you're not using it.If you're new to Web Components, no worries! Simply put, Web Components is a browser API that let's you define your own HTML tags (DOM Elements) to be used in the document. They define the look and behavior of the elements. Have you ever seen an HTML that looks something like this?
``html`
As you may recall from your HTML knowledge, is not somethings built-in in HTML... well, that's because is a Web Component! So the developer created it's own tag to use it in the document.
Web Components are extremely powerfull because they do mostly the same as the components you create in any framework, just they are framework agnostic and feel way more built-in. In other words, if you create a component in your framework you're not allowed to write the following directly in your HTML file:
`html`
You always need to rely on your framework tools in order to render your component, so you must use JavaScript. However, if you create a Web Component you can use it in your HTML with nothing else needed.
> [!IMPORTANT]
> Despite Web Components is a browser API, we used Lit to create the components as it makes the process way much easier. Also, we recommend checking your favorite framework documentation to implement web components, some of them needs a pretty basic setup to get up and running.
``
npm i @thatopen/ui
Then, you need to tell the library to register the components, so you can use them in any HTML syntax. To do it, in your entry JavaScript file execute the following:
`ts
import * as BUI from "@thatopen/ui"
BUI.Manager.init()
`
Finally, in your HTML file you can start to use the components!
`html`
> [!TIP]
> You can get any icon from Iconify!
And, in your JavaScript file:
`js
const grid = document.getElementById("grid")
grid.layouts = {
main:
"header header" auto
"sidebar content" 1fr
"sidebar content" 1fr
/ auto 1fr
}
grid.setLayout("main")
``
To know more about the UIComponents, you can explore the README files in each repository under the packages folder and also explore the documentation. You can find the link at the top of this README file.