Skip to content

docs(select): add new section on rich content options#4512

Open
brandyscarney wants to merge 7 commits into
major-9.0from
FW-7289
Open

docs(select): add new section on rich content options#4512
brandyscarney wants to merge 7 commits into
major-9.0from
FW-7289

Conversation

@brandyscarney
Copy link
Copy Markdown
Member

@brandyscarney brandyscarney commented May 20, 2026

Adds the following:

  1. Select documentation for the new feature allowing HTML to be passed to select options.
  2. Adds a new property to Playground called ionicConfig which allows you to pass config options that get merged with mode in the Playground example.

Preview

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview, Comment May 20, 2026 7:34pm

Request Review

* example: `{ innerHTMLTemplatesEnabled: true }`. Merges with the active
* preview `mode` when opening the editor.
*/
ionicConfig?: IonicConfig;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to add this as a config object instead of adding innerHTMLTemplatesEnabled as a boolean because this will allow us to enhance the Config documentation if desired by adding playgrounds passing different config options.

* Ionic app configuration. See [IonicConfig](/docs/developing/config#ionicconfig).
* Playground only injects serializable values (string, number, boolean) into StackBlitz.
*/
export type IonicConfig = Record<string, unknown>;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to import the type from Ionic but then we would have a dependency on @ionic/core and I don't know if we want that.


## Ionic Config

Pass an [IonicConfig](/docs/developing/config#ionicconfig) object so generated StackBlitz projects bootstrap with the same settings. This is merged with the active preview `mode` when opening the editor. Only string, number, and boolean values are injected into generated code:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose this rather than adding an entire file for each framework to pass the config like Vue but if we prefer that approach I can revert this.

Comment on lines +56 to +64
const formatInterfaceLabel = (selectInterface) => {
return selectInterface
.split('-')
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
};

/* Dynamically create the different Select components */
const selectInterfaces = ['alert', 'action-sheet', 'modal', 'popover'];
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I defined the interface array like this:

const selectInterfaces = [{
  label: 'Alert',
  value: 'alert',
}, {
  label: 'Action Sheet',
  value: 'action-sheet',
}, {
  label: 'Modal',
  value: 'modal',
}, {
  label: 'Popover',
  value: 'popover',
}];

but I removed it in favor of using the single string and converting it to the label. If we think this is too much for the demo, I can go back to the object array.

Comment on lines +102 to +106
/* The interfaceOptions property is for demonstration purposes only. */
/* It is not required for the rich options to work. */
select.interfaceOptions = {
header: 'Travel mode',
};
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to make the demo look nicer but can be removed if desired.

@brandyscarney brandyscarney marked this pull request as ready for review May 20, 2026 18:26
@brandyscarney brandyscarney requested a review from a team as a code owner May 20, 2026 18:26
@brandyscarney brandyscarney requested review from gnbm and thetaPC and removed request for a team and gnbm May 20, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant