Export a `mentionable` property to make child pieces appear in `[[` autocomplete:
```tsx
export default pattern(({ ... }) => {
const childPiece = ChildPattern({ ... });
return {
[NAME]: "Parent",
[UI]:
...
,
mentionable: [childPiece], // Makes childPiece discoverable via [[
};
});
```
For dynamic collections, use a Writable:
```tsx
const createdPieces = Writable.of([]);
const create = handler((_, { createdPieces }) => {
createdPieces.push(ChildPattern({ name: "New" }));
});
return {
[UI]: Create,
mentionable: createdPieces,
};
```
**Notes:**
- Exported mentionables appear in `[[` autocomplete
- They do NOT appear in the sidebar piece list
- Use this instead of writing to `allPieces` directly
# Wishing for Mentionables
Patterns can discover mentionables in the current space using the `scope` parameter:
```tsx
// Search mentionables in current space
const result = wish<{ content: string }>({ query: "#note", scope: ["."] });
// Search both favorites and mentionables
const result = wish<{ content: string }>({ query: "#note", scope: ["~", "."] });
```
See [[wish]] for full documentation of `wish()`, including the result shape and scope parameter.