Skip to content

Commit

Permalink
Restructure API docs to be more cohesive and contextual, specifically…
Browse files Browse the repository at this point in the history
… for predicate helpers
  • Loading branch information
stevepiercy committed Feb 28, 2024
1 parent 59a53fd commit 6eea733
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions docs/source/configuration/slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ Volto comes with the following default slots.

## Configuration registry for slot components

You register a slot component using the configuration registry, as shown.
You can manage slot components using the configuration registry for slot components and its API.


### `registerSlotComponent`

You can register a slot component as shown.

```ts
config.registerSlotComponent({
Expand Down Expand Up @@ -202,12 +207,13 @@ A slot component must have the following parameters.
```


## Predicate helpers
#### Predicate helpers

There are two predicate helpers available in the Volto helpers.
You can also create custom predicate helpers.


### `RouteCondition`
##### `RouteCondition`

```ts
export function RouteCondition(path: string, exact?: boolean) {
Expand All @@ -230,7 +236,7 @@ It accepts the following parameters.
If `true`, then the match will be exact, else matches "begins with", for the given string from `path`.


### `ContentTypeCondition`
##### `ContentTypeCondition`

```ts
export function ContentTypeCondition(contentType: string[]) {
Expand All @@ -243,18 +249,13 @@ The `ContentTypeCondition` helper predicate allows you to render a slot when the
It accepts a list of possible content types.


### Custom predicates
##### Custom predicates

You can create your own predicate helpers to determine whether your slot component should render.
The `SlotRenderer` will pass down the current `content` and the `pathname` into your custom predicate helper.
You can also tailor your own `SlotRenderer`s, or shadow the original `SlotRenderer`, to satisfy your requirements.


## Manage registered slots and slot components

You can manage registered slots and slot components through the slots API.


### `getSlotComponents`

`getSlotComponents` returns the list of components registered in a given slot.
Expand Down

0 comments on commit 6eea733

Please sign in to comment.