semantics of svelte syntax greater then in `action={trigger}> {$open ? 'Close' : 'Open'}`

18 Views Asked by At

I came across this syntax from example in (MeltUI -- a svelte based component library

<Button on:click={() => console.log('clicked')} {...$trigger} action={trigger}>
  {$open ? 'Close' : 'Open'}
</Button>

I want to understand what does the > in action={trigger}> {$open ? 'Close' : 'Open'} used for?

1

There are 1 best solutions below

1
brunnerh On BEST ANSWER

It's just the end of the opening Button tag: <Button ... >

Attribute Meaning
on:click={() => console.log('clicked')} click event handler
{...$trigger} spreading of multiple properties from store trigger
action={trigger} action property being set to JS value trigger