|
| 1 | +import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'; |
| 2 | + |
| 3 | +const data: ReferenceEntityTemplateSchema = { |
| 4 | + name: 'Tabs', |
| 5 | + description: |
| 6 | + 'The `Tabs` component organizes content into separate views, allowing merchants to switch between related information without leaving the current page. Use tabs when you need to present multiple categories of content in a space-efficient manner.' + |
| 7 | + '\n\nTabs consist of a tab list containing clickable tab buttons and corresponding tab panels that display the content. Only one panel is visible at a time, reducing cognitive load and keeping the interface clean.', |
| 8 | + thumbnail: 'tab-thumbnail.png', |
| 9 | + isVisualComponent: true, |
| 10 | + type: '', |
| 11 | + definitions: [ |
| 12 | + { |
| 13 | + title: 'Tabs Properties', |
| 14 | + description: |
| 15 | + 'Configure the following properties on the `Tabs` component.', |
| 16 | + type: 'Tabs', |
| 17 | + }, |
| 18 | + { |
| 19 | + title: 'Tabs Events', |
| 20 | + description: |
| 21 | + 'The `Tabs` component provides event callbacks for handling user interactions. Learn more about [handling events](/docs/api/polaris/using-polaris-web-components#handling-events).', |
| 22 | + type: 'TabsEvents', |
| 23 | + }, |
| 24 | + { |
| 25 | + title: 'TabList', |
| 26 | + description: |
| 27 | + 'The `TabList` component contains the tab buttons. It must be a direct child of the `Tabs` component.', |
| 28 | + type: 'TabListJSXProps', |
| 29 | + }, |
| 30 | + { |
| 31 | + title: 'Tab', |
| 32 | + description: |
| 33 | + 'The `Tab` component represents an individual tab button. It must be placed within a `TabList` and should use the `controls` property to associate it with a corresponding `TabPanel`.', |
| 34 | + type: 'Tab', |
| 35 | + }, |
| 36 | + { |
| 37 | + title: 'TabPanel', |
| 38 | + description: |
| 39 | + 'The `TabPanel` component contains the content for each tab. It must have an `id` that matches the `controls` property of the corresponding `Tab`.', |
| 40 | + type: 'TabPanel', |
| 41 | + }, |
| 42 | + ], |
| 43 | + category: 'Polaris web components', |
| 44 | + subCategory: 'Layout and structure', |
| 45 | + defaultExample: { |
| 46 | + image: 'tab-default.png', |
| 47 | + description: |
| 48 | + 'Organize content into tabs using the `Tabs` component with `TabList`, `Tab`, and `TabPanel` components. This example shows a basic tabbed interface with two tabs.', |
| 49 | + codeblock: { |
| 50 | + title: 'Create a tabbed interface', |
| 51 | + tabs: [ |
| 52 | + { |
| 53 | + code: './examples/default.html', |
| 54 | + language: 'html', |
| 55 | + }, |
| 56 | + ], |
| 57 | + }, |
| 58 | + }, |
| 59 | + subSections: [ |
| 60 | + { |
| 61 | + type: 'Generic', |
| 62 | + anchorLink: 'accessibility', |
| 63 | + title: 'Accessibility', |
| 64 | + sectionContent: ` |
| 65 | +- **Provide accessibility labels:** Use the \`accessibilityLabel\` prop on the \`Tabs\` component to describe the purpose of the tab group. |
| 66 | +- **Ensure keyboard navigation:** The component supports arrow key navigation between tabs and Enter/Space to activate tabs. |
| 67 | +- **Connect tabs and panels:** Always use matching \`controls\` (on Tab) and \`id\` (on TabPanel) properties to maintain proper ARIA relationships. |
| 68 | +`, |
| 69 | + }, |
| 70 | + ], |
| 71 | + related: [], |
| 72 | + examples: { |
| 73 | + description: 'Learn how to handle tab change events.', |
| 74 | + examples: [ |
| 75 | + { |
| 76 | + description: |
| 77 | + 'Subscribe to the `onChange` event to respond when merchants select different tabs. This example shows how to handle tab changes and capture the selected tab value in real time, enabling dynamic behavior based on which tab is active.', |
| 78 | + codeblock: { |
| 79 | + title: 'Handle tab change events', |
| 80 | + tabs: [ |
| 81 | + { |
| 82 | + code: './examples/event-handling.html', |
| 83 | + language: 'html', |
| 84 | + }, |
| 85 | + ], |
| 86 | + }, |
| 87 | + }, |
| 88 | + ], |
| 89 | + }, |
| 90 | +}; |
| 91 | + |
| 92 | +export default data; |
0 commit comments