Default Props
The getDefaultProps
function defines the default props to be applied when a brick instance is added to a page. It should return an object containing these props.
By passing your brick’s props to the types.Brick<T>
generic, you ensure that the object returned by getDefaultProps
is fully typed.
Usage Example
MyBrick.schema = { // ... getDefaultProps: () => ({ imageSide: 'right', title: 'This is the default title', faqs: [ { question: 'Which came first, the chicken or the egg?', answer: "It depends on how you define a chicken's egg. At some point in evolutionary history when there were no chickens yet, two birds that were almost-but-not-quite chickens mated and laid an egg that hatched into the first chicken. If a chicken's egg is defined as 'an egg laid by a chicken', then the chicken came first; if it is defined as 'an egg that a chicken hatches from', then the egg came first.", }, ], }),}