Skip to content

Commit

Permalink
Links
Browse files Browse the repository at this point in the history
  • Loading branch information
cheleb committed Nov 28, 2023
1 parent 0fa60ea commit 6eb3eef
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions docs/_docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
libraryDependencies += "dev.cheleb" %%% "laminar-form-derivation" % "{{ version }}"
```

### Requirements

### Sample
## Sample

```scala sc:nocompile

Expand All @@ -19,29 +18,31 @@ import com.raquo.laminar.api.L.*

import com.raquo.airstream.state.Var

// Declare WidgetFactory for UI5 Web Components
given WidgetFactory = UI5WidgetFactory

// Declare model case class
case class Cat(name: String, age: Int)
case class Dog(name: String, age: Int)

val either = {

case class EitherSample(
either: Either[Cat, Dog],
optionalInt: Option[Int]
)

val eitherVar = Var(EitherSample(Left(Cat("Scala le chat", 6)), Some(1)))

div(
child <-- eitherVar.signal.map { item =>
div(
s"$item"
)
},
Form.renderVar(eitherVar)
)
}
case class EitherSample(
either: Either[Cat, Dog],
optionalInt: Option[Int]
)

// Laminar variable binding
val eitherVar = Var(EitherSample(Left(Cat("Scala le chat", 6)), Some(1)))

div(
// Debug output of the model as soon as it changes.
child <-- eitherVar.signal.map { item =>
div(
s"$item"
)
},
// Render the forms
Form.renderVar(eitherVar)
)


```

0 comments on commit 6eb3eef

Please sign in to comment.