|
| 1 | +<p> |
| 2 | + <small> |
| 3 | + <em>Note:</em> When using a custom toggle, you must slot in a <code>pf-dropdown-menu</code>. |
| 4 | + </small> |
| 5 | + <span id="switch-group"> |
| 6 | + <pf-switch id="disable-all"></pf-switch> |
| 7 | + <label for="disable-all"><span data-state="on">Enable</span><span data-state="off">Disable</span> all dropdowns</label> |
| 8 | + </span> |
| 9 | +</p> |
| 10 | + |
| 11 | +<pf-dropdown id="control"> |
| 12 | + <pf-button variant="control" slot="toggle"> |
| 13 | + Control toggle |
| 14 | + <pf-icon size="md" icon="caret-down"></pf-icon> |
| 15 | + </pf-button> |
| 16 | + <pf-dropdown-menu slot="menu"> |
| 17 | + <pf-dropdown-item>item4</pf-dropdown-item> |
| 18 | + <hr> |
| 19 | + <pf-dropdown-group label="Group 1"> |
| 20 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 21 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 22 | + <hr> |
| 23 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 24 | + </pf-dropdown-group> |
| 25 | + <pf-dropdown-group label="Group 2"> |
| 26 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 27 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 28 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 29 | + <pf-dropdown-item disabled>disabled</pf-dropdown-item> |
| 30 | + </pf-dropdown-group> |
| 31 | + </pf-dropdown-menu> |
| 32 | +</pf-dropdown> |
| 33 | + |
| 34 | +<pf-dropdown id="primary"> |
| 35 | + <pf-button variant="primary" slot="toggle">Primary toggle</pf-button> |
| 36 | + <pf-dropdown-menu slot="menu"> |
| 37 | + <pf-dropdown-item>item4</pf-dropdown-item> |
| 38 | + <hr> |
| 39 | + <pf-dropdown-group label="Group 1"> |
| 40 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 41 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 42 | + <hr> |
| 43 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 44 | + </pf-dropdown-group> |
| 45 | + <pf-dropdown-group label="Group 2"> |
| 46 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 47 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 48 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 49 | + <pf-dropdown-item disabled>disabled</pf-dropdown-item> |
| 50 | + </pf-dropdown-group> |
| 51 | + </pf-dropdown-menu> |
| 52 | +</pf-dropdown> |
| 53 | + |
| 54 | +<pf-dropdown id="secondary"> |
| 55 | + <pf-button variant="secondary" slot="toggle">Secondary toggle</pf-button> |
| 56 | + <pf-dropdown-menu slot="menu"> |
| 57 | + <pf-dropdown-item>item4</pf-dropdown-item> |
| 58 | + <hr> |
| 59 | + <pf-dropdown-group label="Group 1"> |
| 60 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 61 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 62 | + <hr> |
| 63 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 64 | + </pf-dropdown-group> |
| 65 | + <pf-dropdown-group label="Group 2"> |
| 66 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 67 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 68 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 69 | + <pf-dropdown-item disabled>disabled</pf-dropdown-item> |
| 70 | + </pf-dropdown-group> |
| 71 | + </pf-dropdown-menu> |
| 72 | +</pf-dropdown> |
| 73 | + |
| 74 | +<pf-dropdown id="plain"> |
| 75 | + <pf-button plain slot="toggle">Plain toggle</pf-button> |
| 76 | + <pf-dropdown-menu slot="menu"> |
| 77 | + <pf-dropdown-item>item4</pf-dropdown-item> |
| 78 | + <hr> |
| 79 | + <pf-dropdown-group label="Group 1"> |
| 80 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 81 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 82 | + <hr> |
| 83 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 84 | + </pf-dropdown-group> |
| 85 | + <pf-dropdown-group label="Group 2"> |
| 86 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 87 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 88 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 89 | + <pf-dropdown-item disabled>disabled</pf-dropdown-item> |
| 90 | + </pf-dropdown-group> |
| 91 | + </pf-dropdown-menu> |
| 92 | +</pf-dropdown> |
| 93 | + |
| 94 | +<pf-dropdown id="icon"> |
| 95 | + <pf-button plain slot="toggle" icon="ellipsis-v" label="Icon toggle"></pf-button> |
| 96 | + <pf-dropdown-menu slot="menu"> |
| 97 | + <pf-dropdown-item>item4</pf-dropdown-item> |
| 98 | + <hr> |
| 99 | + <pf-dropdown-group label="Group 1"> |
| 100 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 101 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 102 | + <hr> |
| 103 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 104 | + </pf-dropdown-group> |
| 105 | + <pf-dropdown-group label="Group 2"> |
| 106 | + <pf-dropdown-item>item1</pf-dropdown-item> |
| 107 | + <pf-dropdown-item>item2</pf-dropdown-item> |
| 108 | + <pf-dropdown-item>item3</pf-dropdown-item> |
| 109 | + <pf-dropdown-item disabled>disabled</pf-dropdown-item> |
| 110 | + </pf-dropdown-group> |
| 111 | + </pf-dropdown-menu> |
| 112 | +</pf-dropdown> |
| 113 | + |
| 114 | +<script type="module"> |
| 115 | + import '@patternfly/elements/pf-dropdown/pf-dropdown.js'; |
| 116 | + import '@patternfly/elements/pf-switch/pf-switch.js'; |
| 117 | + const sw = document.getElementById('disable-all') |
| 118 | + sw.addEventListener('click', function() { |
| 119 | + document.querySelectorAll('main pf-dropdown').forEach(x => x.disabled = sw.checked); |
| 120 | + }) |
| 121 | +</script> |
| 122 | + |
| 123 | + |
| 124 | +<style> |
| 125 | +#switch-group { |
| 126 | + display: inline-flex; |
| 127 | + justify-content: center; |
| 128 | + vertical-align: middle; |
| 129 | + gap: 8px; |
| 130 | +} |
| 131 | +</style> |
0 commit comments