Skip to content

Commit 36b1459

Browse files
committed
Add documentation and example for Admin Modal component
1 parent f92b09e commit 36b1459

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

.changeset/small-roses-double.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': patch
3+
---
4+
5+
Add documentation for Admin Modal
23.2 KB
Loading

packages/ui-extensions/src/docs/shared/components/Modal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const data: SharedReferenceEntityTemplateSchema = {
55
description:
66
'Use modal to display content in a overlay. This component is useful for creating a distraction-free experience, such as a confirmation dialog or a settings panel.',
77
category: 'Polaris web components',
8-
subCategory: 'Overlay',
8+
subCategory: 'Overlays',
99
related: [],
1010
};
1111

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {AdminReferenceEntityTemplateSchema} from '../../docs-types';
2+
import sharedContent from '../../../../docs/shared/components/Modal';
3+
4+
const data: AdminReferenceEntityTemplateSchema = {
5+
...sharedContent,
6+
thumbnail: '/assets/templated-apis-screenshots/admin/components/modal.png',
7+
isVisualComponent: true,
8+
definitions: [
9+
{
10+
title: 'Properties',
11+
description: '',
12+
type: 'Modal',
13+
},
14+
{
15+
title: 'Events',
16+
description:
17+
'Learn more about [registering events](/docs/api/app-home/using-polaris-components#event-handling).',
18+
type: 'ModalEvents',
19+
},
20+
{
21+
title: 'Slots',
22+
description: '',
23+
type: 'ModalSlots',
24+
},
25+
],
26+
defaultExample: {
27+
codeblock: {
28+
title: 'Code',
29+
tabs: [
30+
{
31+
code: './examples/default.html',
32+
language: 'preview',
33+
customStyles: {
34+
minHeight: '300px',
35+
},
36+
},
37+
],
38+
},
39+
},
40+
};
41+
42+
export default data;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<s-button commandFor="modal">
2+
Open
3+
</s-button>
4+
5+
<s-modal id="modal" heading="Details">
6+
<s-paragraph>
7+
Displaying more details here.
8+
</s-paragraph>
9+
10+
<s-button
11+
slot="secondary-actions"
12+
commandFor="modal"
13+
command="--hide">
14+
Close
15+
</s-button>
16+
<s-button
17+
slot="primary-action"
18+
variant="primary"
19+
commandFor="modal"
20+
command="--hide">
21+
Save
22+
</s-button>
23+
</s-modal>

0 commit comments

Comments
 (0)