Podcast
Questions and Answers
What is the primary function of widgets in Spire?
What is the primary function of widgets in Spire?
When is it more appropriate to create a new custom widget instead of overriding an existing one?
When is it more appropriate to create a new custom widget instead of overriding an existing one?
What directory path is suggested for creating a new widget within the Blueprint?
What directory path is suggested for creating a new widget within the Blueprint?
Which development environment is used for creating a custom widget in this example?
Which development environment is used for creating a custom widget in this example?
Signup and view all the answers
What is an advantage of overriding an existing widget in Spire?
What is an advantage of overriding an existing widget in Spire?
Signup and view all the answers
What object must every widget in Spire default export?
What object must every widget in Spire default export?
Signup and view all the answers
What must you do to start Spire from VS Code?
What must you do to start Spire from VS Code?
Signup and view all the answers
Where do you find the ExampleWidget widget to add it to the Home page?
Where do you find the ExampleWidget widget to add it to the Home page?
Signup and view all the answers
What is required to customize a widget after it has been added to a page?
What is required to customize a widget after it has been added to a page?
Signup and view all the answers
What happens after a custom widget is created and added to a page?
What happens after a custom widget is created and added to a page?
Signup and view all the answers
Which two field definitions are mentioned as pre-defined attributes for widgets?
Which two field definitions are mentioned as pre-defined attributes for widgets?
Signup and view all the answers
What level of control do developers have over custom widgets?
What level of control do developers have over custom widgets?
Signup and view all the answers
What is the purpose of the enum named 'fields' in the ExampleWidget?
What is the purpose of the enum named 'fields' in the ExampleWidget?
Signup and view all the answers
Which field in the WidgetDefinition requires a default value of zero?
Which field in the WidgetDefinition requires a default value of zero?
Signup and view all the answers
What does the 'placeholder' property do in the field definitions?
What does the 'placeholder' property do in the field definitions?
Signup and view all the answers
In the ExampleWidget component, how is the checkboxFieldValue displayed?
In the ExampleWidget component, how is the checkboxFieldValue displayed?
Signup and view all the answers
What type of value does the multilineTextFieldValue accept?
What type of value does the multilineTextFieldValue accept?
Signup and view all the answers
Which of the following fields is marked as requiring a tooltip?
Which of the following fields is marked as requiring a tooltip?
Signup and view all the answers
What kind of component is ExampleWidget classified as?
What kind of component is ExampleWidget classified as?
Signup and view all the answers
What would be the type of props in the ExampleWidget component?
What would be the type of props in the ExampleWidget component?
Signup and view all the answers
Which of the following options is NOT a valid field in the WidgetDefinition?
Which of the following options is NOT a valid field in the WidgetDefinition?
Signup and view all the answers
Which default value setting should be used for drop-downFieldValue?
Which default value setting should be used for drop-downFieldValue?
Signup and view all the answers
Study Notes
Creating a Custom Widget in Spire
- Spire widgets provide a way to add content to pages without development, offering different views based on user roles, languages, and devices.
- You can either override existing widgets for minor modifications or create new custom widgets for completely new functionality.
- Creating a custom widget involves defining field definitions that are displayed as editable elements in the CMS.
- Example: Create a widget showcasing various field definitions like checkbox, text, integer, multiline text, radio buttons, and drop-down.
- The widget code is written in TypeScript and defines a React component (ExampleWidget) and its associated definition (widgetModule).
- The widget definition includes details like group, field definitions, component, and other configuration options.
- You can add custom field definitions using components like CheckboxField, TextField, IntegerField, MultilineTextField, RadioButtonsField, and drop-downField.
-
Steps to Create and Publish a Custom Widget:
- Create a directory for your widget (e.g., /Widgets/Common).
- Create a TypeScript file for the widget (e.g., ExampleWidget.tsx) and define the component and its field definitions.
- Start the Spire server (using Node.js or a launch configuration in VS Code).
- Access the Content Admin interface (http://localhost:3000/contentadmin) and edit the desired page.
- Add a new row to the page and add the custom widget using the "Add Widget" modal.
- Configure the widget using the field definitions displayed in the sidebar.
- Publish the changes to the page.
- Access the page and view the widget you created.
-
Widget Field Definitions:
- In Spire, widgets use field definitions to control how their properties are modified in the CMS.
- You can use pre-defined field definitions or create your own custom definitions using React components.
-
Publishing Custom Widgets:
- Once created, custom widgets can be added to pages using the CMS, just like pre-defined widgets.
- CMS users can customize them using the provided field definitions.
- Developers have granular control over the widget by modifying its code.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz explores the process of creating custom widgets in Spire using TypeScript and React. You'll learn about defining field definitions, implementing various editable elements, and how to customize widget functionalities based on user roles and languages. Get ready to test your knowledge on widget configuration and development best practices!