|
1 | 1 | --- |
2 | 2 | name: Stateful |
3 | | -description: Stateful buttons communicate notification state with variant="stateful" and state set to read, unread, or attention. Set clicked to force the clicked/active styling. |
| 3 | +description: Stateful buttons communicate notification state with variant="stateful" and state set to read, unread (default), or attention. |
4 | 4 | --- |
5 | 5 |
|
6 | | -<strong>Read</strong> |
7 | | -<br /> |
8 | | -<pf-v6-button variant="stateful" state="read"> |
9 | | - <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
10 | | - <path d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"></path> |
11 | | - </svg> |
12 | | - 10<span class="pf-v6-screen-reader">items</span> |
13 | | -</pf-v6-button> |
14 | | -<pf-v6-button variant="stateful" state="read" clicked> |
15 | | - <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
16 | | - <path d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"></path> |
17 | | - </svg> |
18 | | - 10<span class="pf-v6-screen-reader">items</span> |
19 | | -</pf-v6-button> |
20 | | - |
21 | | -<br /><br /> |
22 | | - |
23 | | -<strong>Unread</strong> |
24 | | -<br /> |
25 | | -<pf-v6-button variant="stateful" state="unread"> |
26 | | - <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
27 | | - <path d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"></path> |
28 | | - </svg> |
29 | | - 10<span class="pf-v6-screen-reader">unread items</span> |
30 | | -</pf-v6-button> |
31 | | -<pf-v6-button variant="stateful" state="unread" clicked> |
32 | | - <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
33 | | - <path d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"></path> |
34 | | - </svg> |
35 | | - 10<span class="pf-v6-screen-reader">unread items</span> |
36 | | -</pf-v6-button> |
37 | | - |
38 | | -<br /><br /> |
39 | | - |
40 | | -<strong>Attention</strong> |
41 | | -<br /> |
42 | | -<pf-v6-button variant="stateful" state="attention"> |
43 | | - <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
44 | | - <path d="M28 21c-1.103 0-2-.897-2-2v-4c0-4.884-3.523-8.955-8.159-9.823.405-.444.659-1.03.659-1.677C18.5 2.121 17.379 1 16 1s-2.5 1.121-2.5 2.5c0 .648.254 1.233.659 1.677C9.523 6.045 6 10.116 6 15v4c0 1.103-.897 2-2 2a1 1 0 0 0-1 1v3.5c0 .827.673 1.5 1.5 1.5H12c0 2.206 1.794 4 4 4s4-1.794 4-4h7.5c.827 0 1.5-.673 1.5-1.5V22a1 1 0 0 0-1-1ZM14.5 11a1.5 1.5 0 0 1 3 0v5a1.5 1.5 0 0 1-3 0v-5ZM16 24.014a2 2 0 1 1-.001-3.999A2 2 0 0 1 16 24.014Z"></path> |
45 | | - </svg> |
46 | | - 10<span class="pf-v6-screen-reader">unread items, needs attention</span> |
47 | | -</pf-v6-button> |
48 | | -<pf-v6-button variant="stateful" state="attention" clicked> |
49 | | - <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
50 | | - <path d="M28 21c-1.103 0-2-.897-2-2v-4c0-4.884-3.523-8.955-8.159-9.823.405-.444.659-1.03.659-1.677C18.5 2.121 17.379 1 16 1s-2.5 1.121-2.5 2.5c0 .648.254 1.233.659 1.677C9.523 6.045 6 10.116 6 15v4c0 1.103-.897 2-2 2a1 1 0 0 0-1 1v3.5c0 .827.673 1.5 1.5 1.5H12c0 2.206 1.794 4 4 4s4-1.794 4-4h7.5c.827 0 1.5-.673 1.5-1.5V22a1 1 0 0 0-1-1ZM14.5 11a1.5 1.5 0 0 1 3 0v5a1.5 1.5 0 0 1-3 0v-5ZM16 24.014a2 2 0 1 1-.001-3.999A2 2 0 0 1 16 24.014Z"></path> |
51 | | - </svg> |
52 | | - 10<span class="pf-v6-screen-reader">unread items, needs attention</span> |
53 | | -</pf-v6-button> |
| 6 | +<div class="stateful-demo"> |
| 7 | + <div> |
| 8 | + <div><strong>Read</strong></div> |
| 9 | + <pf-v6-button variant="stateful" state="read"> |
| 10 | + <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
| 11 | + <path d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"></path> |
| 12 | + </svg> |
| 13 | + 10<span class="pf-v6-screen-reader">items</span> |
| 14 | + </pf-v6-button> |
| 15 | + </div> |
| 16 | + <div> |
| 17 | + <div><strong>Unread</strong></div> |
| 18 | + <pf-v6-button variant="stateful" state="unread"> |
| 19 | + <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
| 20 | + <path d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"></path> |
| 21 | + </svg> |
| 22 | + 10<span class="pf-v6-screen-reader">unread items</span> |
| 23 | + </pf-v6-button> |
| 24 | + </div> |
| 25 | + <div> |
| 26 | + <div><strong>Attention</strong></div> |
| 27 | + <pf-v6-button variant="stateful" state="attention"> |
| 28 | + <svg slot="icon" fill="currentColor" height="1em" width="1em" viewBox="0 0 32 32" aria-hidden="true"> |
| 29 | + <path d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"></path> |
| 30 | + </svg> |
| 31 | + 10<span class="pf-v6-screen-reader">unread items, needs attention</span> |
| 32 | + </pf-v6-button> |
| 33 | + </div> |
| 34 | +</div> |
54 | 35 |
|
55 | 36 | <script type="module"> |
56 | 37 | import '@patternfly/elements/pf-v6-button/pf-v6-button.js'; |
57 | 38 | </script> |
58 | 39 |
|
59 | 40 | <style> |
| 41 | + .stateful-demo { |
| 42 | + display: flex; |
| 43 | + gap: 1rem; |
| 44 | + align-items: flex-start; |
| 45 | + } |
| 46 | + |
| 47 | + .stateful-demo strong { |
| 48 | + font-family: var(--pf-t--global--font--family--body, "Red Hat Text", RedHatText, Helvetica, Arial, sans-serif); |
| 49 | + font-size: 0.875rem; |
| 50 | + } |
| 51 | + |
60 | 52 | .pf-v6-screen-reader { |
61 | 53 | position: absolute; |
62 | 54 | width: 1px; |
|
0 commit comments