Is it possible to custom restyle elements in {active_elements} property? #189
Answered
by
janosh
Youjin1985
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
janosh
Nov 4, 2025
Replies: 1 comment
-
|
see the new "Active Elements Border Styling" example on https://matterviz.janosh.dev/periodic-table <script>
let active_elements_demo = $state([`H`, `C`, `N`, `O`, `Fe`, `Cu`, `Au`, `Ag`])
let active_tile_border = $state({ width: `2px`, style: `solid`, color: `#ff0000` })
</script>
<PeriodicTable
tile_props={{ show_name: window_width > 800 }}
active_elements={active_elements_demo}
style={`--elem-tile-active-border: ${active_tile_border.width} ${active_tile_border.style} ${active_tile_border.color}`}
{onenter}
>
{#snippet inset()}
<TableInset
style="display: flex; gap: 1em; place-content: center; flex-wrap: wrap; align-items: center"
>
<select bind:value={active_tile_border.width}>
<option>1px</option>
<option>2px</option>
<option>3px</option>
</select>
<select bind:value={active_tile_border.style}>
<option>solid</option>
<option>dashed</option>
<option>dotted</option>
</select>
<input type="color" bind:value={active_tile_border.color} style="height: 1.5em" />
<code style="background: var(--sms-ui-bg); padding: 4px 8px; border-radius: 4px">
{active_tile_border.width} {active_tile_border.style} {active_tile_border.color}
</code>
</TableInset>
{/snippet}
</PeriodicTable> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Youjin1985
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

see the new "Active Elements Border Styling" example on https://matterviz.janosh.dev/periodic-table