# Slots API specification ## Slots definition Fluent UI components are often composed internally with different subparts to help with layouts. These pre-defined layouts can be configured via the Slots API. Slots are named areas in a component that can receive props for styling and layout. For example, `Button` component contains `content`, `loader` and `icon` slots in its layout: ```jsx // ⚠️ not a real JSX/DOM markup ``` Slots define the complex layouts required by many components according to accessibility and design requirements automatically. Slots can be configured through props, allowing the caller pass in a variety of inputs for a given slot. ## Slots components Each slot is represented by a React component or a primitive, for example: `slots.loader` can be a `Loader` component and `slots.icon` can be a `span`: ```jsx // ⚠️ not a real JSX/DOM markup <> {/* renders a ``` Any props which are valid for a component can be passed to a slot, i.e. ARIA, `data-*` attributes and event handlers. ```jsx ``` Our components will prevent passing invalid props to DOM (check `getNativeElementProps()` for more details): ```jsx ``` ### Primitives as a value We consider JSX elements as primitive values that will be passed to a meaningful prop, by default to `children` (but this can be configured in the component's implementation): ```jsx <> ``` ⚠️An important note is that `children` function replaces the whole slot, not its contents. ## Slot for collections Besides slots for single (scalar) values, v0/Northstar also supports slots for collections (array of items in `Menu` component). Converged components will **not** support slots for collections but will rather use Children API in these cases.