From d1bb17f52b9f856b7cc91588bcc6333d75986d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helmut=20H=C3=A4nsel?= Date: Sat, 21 Oct 2023 23:00:16 +0200 Subject: [PATCH] improve docstring for js_attr --- src/stipple/rendering.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/stipple/rendering.jl b/src/stipple/rendering.jl index 56767eee..633649fb 100644 --- a/src/stipple/rendering.jl +++ b/src/stipple/rendering.jl @@ -160,6 +160,18 @@ end js_attr(x) Renders a Julia expression as Javascript Expression that can be passed as an attribute value in html elements. +### Example +``` +using StippleUI + +quasar( + :btn__toggle, + fieldname = :btn_value, + options = js_attr([opts(label = "Off", value = false), opts(label = "On", value = true)]) +) + +# "" +``` """ function js_attr(x) Symbol(replace(json(render(x)), "'" => raw"\'", '"' => '''))