Skip to content

nguyenyou/webawesome-laminar

Repository files navigation

Scala3 Maven Central Version


Laminar bindings for WebAwesome web components library

Quickstart

Following these simple steps for a quickstart.

npx degit nguyenyou/webawesome-laminar/quickstart webawesome-laminar-quickstart
cd webawesome-laminar-quickstart
npm install
npm run dev

Open: http://localhost:5173/

Manual Setup

https://webawesome-laminar.vercel.app/docs/getting-started

Notable feature

For attributes that accept a fixed set of string values, this library offers two ergonomic ways to work with them:

1. Union Types (Type-Safe Strings)

You can assign string values directly while still enjoying full type safety via Scala’s union types. This works both for String and Signal[String].

Button(
  _.variant := "success" // String
)("Click me")

Button(
  _.variant <-- Val("success") // Signal[String]
)("Click me")

2. Dot notation

For cases where the attribute value is static and known at compile time, you can use dot notation for better discoverability and cleaner syntax:

Button(
  _.variant.success
)()

One advantage of this syntax is that it allows for faster typing.

Credits

While building this library, I learned a lot and borrowed many ideas from Nikita’s laminar-shoelace-components library.

Author

Tu Nguyen - @younguyen95

License

This project is provided under the MIT license.

About

Laminar bindings for WebAwesome web components library

Resources

License

Stars

Watchers

Forks

Packages

No packages published