Skip to content

688 document kotlin dsl#742

Draft
MatthewHawkins wants to merge 2 commits intomainfrom
688-document-kotlin-dsl
Draft

688 document kotlin dsl#742
MatthewHawkins wants to merge 2 commits intomainfrom
688-document-kotlin-dsl

Conversation

@MatthewHawkins
Copy link
Member

No description provided.

@MatthewHawkins MatthewHawkins linked an issue Feb 13, 2026 that may be closed by this pull request
@MatthewHawkins MatthewHawkins marked this pull request as draft February 13, 2026 16:40
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

vale

docs/docs/integrations/kotlin-dsl/overview.md|45 col 5| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|47 col 9| [Google.Colons] ': A' should be in lowercase.
docs/docs/integrations/kotlin-dsl/overview.md|47 col 113| [Google.Colons] ': M' should be in lowercase.
docs/docs/integrations/kotlin-dsl/overview.md|50 col 88| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|50 col 172| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|55 col 38| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|59 col 4| [Google.Headings] 'Kotlin for Java developers' should use sentence-style capitalization.
docs/docs/integrations/kotlin-dsl/overview.md|62 col 72| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|101 col 5| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.
docs/docs/integrations/kotlin-dsl/overview.md|118 col 43| [Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.

@@ -0,0 +1,214 @@
---
title: Extending the DSL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.

sidebar_position: 20
---

The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.

sidebar_position: 20
---

The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.

sidebar_position: 20
---

The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.


The Kotlin DSL is extensible, allowing the addition of DSL functions for custom components or third-party libraries. You can build composite components that use the DSL internally.

## Adding components to the DSL {#adding-components-to-the-dsl}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.


## Common parameters {#common-parameters}

You've seen configuration blocks used throughout these examples. Most DSL functions also accept common parameters before the block for frequently-used options:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.


## Common parameters {#common-parameters}

You've seen configuration blocks used throughout these examples. Most DSL functions also accept common parameters before the block for frequently-used options:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Google.LyHyphens] 'frequently-used' doesn't need a hyphen.

}
```

The DSL keeps the UI structure readable while giving you full access to component configuration.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.

@@ -0,0 +1,138 @@
---
title: Kotlin DSL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.

`}</style>
</Head>

webforJ provides a Kotlin *Domain Specific Language*, or DSL, that lets you build UIs with concise, type-safe syntax. Instead of imperative Java code, you write declarative code that reads like a description *of your UI structure.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'DSL', if it's unfamiliar to the audience.

}
}
```
:::important Using the `Break` component

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recently had to change the names for the header and footer DSL methods to nativeHeader and nativeFooter to avoid conflicts with header and footer slots of other components. This should be mentioned here too.


```kotlin
button("Primary Action") {
addClassName("btn-primary")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the HasClassName extension can be used, that allows to add class names via + or +=.

Suggested change
addClassName("btn-primary")
classNames += "btn-primary"


```kotlin
// Text parameter for labels/content
button("Click me") { }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the closure is empty it can be omitted.

Suggested change
button("Click me") { }
button("Click me")

class ContactView : Composite<Div>() {

init {
boundComponent = div {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boundComponent cannot be assigned, either use a self variable or use the apply scope function

Suggested change
boundComponent = div {
boundComponent.apply {

or

Suggested change
boundComponent = div {
self = boundComponent
self.apply {

val searchButton: Button

init {
boundComponent = div {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boundComponent cannot be assigned, either use boundComponent.apply or use a self variable.

Suggested change
boundComponent = div {
boundComponent.apply {

or

Suggested change
boundComponent = div {
val self = boundComponent
self.apply {


fun onSearch(handler: (String) -> Unit) {
searchButton.onClick {
handler(searchField.text ?: "")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The elvis operator is not required here, String is not nullable, if it should allow null values change it to String?.

}

init {
boundComponent = div {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boundComponent cannot be assigned, either use boundComponent.apply or use a self variable.

Suggested change
boundComponent = div {
boundComponent.apply {

or

Suggested change
boundComponent = div {
val self = boundComponent
self.apply {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document Kotlin DSL

2 participants