@@ -44,3 +44,12 @@ export default function App() {
);
}
```
## Hide the collection picker and hard code the collection you want people to save stuff to
With static questions, you set a specific collection as the collection people can save items to, so that they don't have bother picking a collection. To hard-code a collection:
1. Set `isSaveEnabled` to true.
2. Set `saveToCollectionId` to the collection ID you want people to save items to.
For more options, see [Question props](./questions.md#question-props).
| questionId | `number \| string` | (required) The ID of the question. This is either:<br>- The numerical ID when accessing a question link, e.g., `http://localhost:3000/question/1-my-question` where the ID is `1`.<br>- The `entity_id` key of the question object. You can find a question's entity ID in the info panel when viewing a question. |
| plugins | `{ mapQuestionClickActions: Function } \| null` | Additional mapper function to override or add drill-down menu. |
| height | `number \| string` | (optional) A number or string specifying a CSS size value that specifies the height of the component |
| entityTypeFilter | `("table" \| "question" \| "model" \| "metric")[]` | (optional) An array that specifies which entity types are available in the data picker |
| isSaveEnabled | `boolean` | (optional) Whether people can save the question. |
| withResetButton | `boolean` | (optional, default: `true`) Determines whether a reset button is displayed. Only relevant when using the default layout |
| withTitle | `boolean` | (optional, default: `false`) Determines whether the question title is displayed. Only relevant when using the default layout. |
| customTitle | `string \| undefined` | (optional) Allows a custom title to be displayed instead of the default question title. Only relevant when using the default layout. |
| onBeforeSave | `() => void` | (optional) A callback function that triggers before saving. Only relevant when `isSaveEnabled = true`. |
| onSave | `() => void` | (optional) A callback function that triggers when a user saves the question. Only relevant when `isSaveEnabled = true`. |
| saveToCollectionId | `number` | (optional) The target collection to save the question to. This will hide the collection picker from the save modal. Only applicable to static questions. |
| questionId | number or string | (required) The ID of the question. This is either:<br>- The numerical ID when accessing a question link, e.g., `http://localhost:3000/question/1-my-question` where the ID is `1`.<br>- The `entity_id` key of the question object. You can find a question's entity ID in the info panel when viewing a question. |
| plugins | `{ mapQuestionClickActions: Function }` or null | Additional mapper function to override or add drill-down menu. |
| height | number or string | (optional) A number or string specifying a CSS size value that specifies the height of the component |
| entityTypeFilter | string array; options include "table", "question", "model", "metric" | (optional) An array that specifies which entity types are available in the data picker |
| isSaveEnabled | boolean | (optional) Whether people can save the question. |
| withResetButton | boolean | (optional, default: `true`) Determines whether a reset button is displayed. Only relevant when using the default layout |
| withTitle | boolean | (optional, default: `false`) Determines whether the question title is displayed. Only relevant when using the default layout. |
| customTitle | string or undefined | (optional) Allows a custom title to be displayed instead of the default question title. Only relevant when using the default layout. |
| onBeforeSave | `() => void`| (optional) A callback function that triggers before saving. Only relevant when `isSaveEnabled = true`. |
| onSave | `() => void`| (optional) A callback function that triggers when a user saves the question. Only relevant when `isSaveEnabled = true`. |
| saveToCollectionId | number | (optional) The target collection to save the question to. This will hide the collection picker from the save modal. Only applicable to static questions. |
## Customizing interactive questions
...
...
@@ -137,7 +137,7 @@ To customize the layout, use namespaced components within the `InteractiveQuesti
These components are available via the `InteractiveQuestion` namespace (e.g., `<InteractiveQuestion.Filter />`).