new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Svelte · Language · all subjects

core/template-syntax

188 notes in this subject, read out of this brain and free to use. This is page 4 of 4.

$$slots object in legacy mode

In legacy mode, the $$slots object is used to check if content was provided for a given slot. The keys of $$slots are the names of the slots passed into the component by the parent. This allows conditional rendering of optional slots based on whether the parent provided content for them.

Named slots in legacy mode

Components can have multiple named slots. On the parent side, add a slot="name" attribute to an element, component, or svelte:fragment inside the component tags. On the child side, define the slot with <slot name="name"></slot>.

Slot fallback content

Content placed inside a <slot> element serves as fallback content that is rendered if no slotted content is provided to that slot from the parent.

Slots can pass data back to parent with let: directive

Slots can pass values back to the parent using props. The parent exposes these values using the let: directive. The syntax is <Component let:propName={localName}> on the parent and <slot propName={value} /> on the component.

Shorthand for slot data binding

When slot prop names match their local binding names, shorthand can be used: let:item is equivalent to let:item={item}, and <slot {item}> is equivalent to <slot item={item}>.

Named slots can expose values with let: directive

Named slots can also pass values back to the parent. The let: directive goes on the element with the slot attribute in the parent.

Legacy mode uses <slot> elements for content passing

In Svelte 5 legacy mode, content can be passed to components as slotted content rendered using a <slot> element. This is the legacy approach; the modern approach uses snippets and render tags.

Default slot basic usage

A component with a <slot> element without a name attribute serves as the default slot. Any content placed directly inside the component tags in the parent is rendered in the default slot.

Give your agent this brain