Confused about children placeholder #1052
-
Hi. I am a beginner just reading through the docs. I got stuck not understanding about the section 'Rendering children in your widgets. (defwidget labeled-container [name]
(box :class "container"
name
(children)))
(labeled-container :name "foo"
(button :onclick "notify-send hey ho"
"click me")) can someone explain clearly what is the children placeholder's functionality here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When using your custom widget, you may want to put other widgets inside – e.g. for having reusable containers like buttons with some icon and label. Just like a box or a button can have children (elements inside it), your custom widgets can, too. In your custom widget, when you use the |
Beta Was this translation helpful? Give feedback.
When using your custom widget, you may want to put other widgets inside – e.g. for having reusable containers like buttons with some icon and label. Just like a box or a button can have children (elements inside it), your custom widgets can, too. In your custom widget, when you use the
children
placeholder somewhere, and you put some children into your invocation of the custom widget, those children will be put where the placeholder is