Comments (2)
There are different ways. If you are using bootstrap module, you can just implement bootstrap collapse component (https://getbootstrap.com/docs/5.3/components/collapse/):
button("Toggle bootstrap collapse") {
setAttribute("data-bs-toggle", "collapse")
setAttribute("data-bs-target", "#panel")
setAttribute("aria-expanded", "false")
setAttribute("aria-controls", "panel")
}
div(className = "collapse") {
id = "panel"
div(className = "card card-body") {
+"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante."
}
}
You can also manage component visibility directly:
lateinit var panel: Div
button("Toggle direct") {
onClick {
panel.toggleVisible()
}
}
panel = div(className = "card card-body") {
visible = false
+"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante."
}
If you like more reactive way here you have:
val visibleState = ObservableValue(false)
button("Toggle reactive") {
onClick {
visibleState.value = !visibleState.value
}
}
div(className = "card card-body").bind(visibleState) {
visible = it
+"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante."
}
from kvision.
Thank you. I used the reactive approach
from kvision.
Related Issues (20)
- trying to generate .pot files HOT 12
- overrides of `SimplePanel.AddAll` call refresh outside of a `singleRender` wrapper. HOT 1
- Allow KVService to have arguments with GET HOT 6
- Allow modifying response headers for Spring Boot and Micronaut apps HOT 1
- remove id parameter on get requests HOT 1
- Can't get data from Tabulator.RowComponent HOT 2
- How to attch files using the Richtext Component HOT 7
- duplicated different word in kvision docs HOT 1
- did you consider to integrate kvision with ktor client? HOT 5
- can't make tabulator selectable with kvision v7.4.4 HOT 2
- My tabulator not selecting data HOT 5
- How to add more than one bottomCalc rows? HOT 2
- kvision gradle plugin not works well with Spring-Web-Flux HOT 4
- DropDown - call method instead of loading a route HOT 2
- Page loader how to. HOT 4
- Gantt and Calendar view of tasks HOT 7
- Issue integrating react-big-schedule HOT 3
- Make Alert Button Text Customizable HOT 1
- Incorrect checkbox size HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kvision.