|
| 1 | +# PatternFly Elements Hint |
| 2 | + |
| 3 | +A **hint** is in-app messaging that provides a one-step reminder, explanation, or call to action for a page or modal. Hints provide information about an interaction or prerequisite step that might not be immediately obvious to the user. |
| 4 | + |
| 5 | +Read more about Hint in the [PatternFly Elements Hint documentation](https://patternflyelements.org/components/hint) |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +Load `<pf-hint>` via CDN: |
| 10 | + |
| 11 | +```html |
| 12 | +<script src="https://jspm.dev/@patternfly/elements/pf-hint/pf-hint.js"></script> |
| 13 | +``` |
| 14 | + |
| 15 | +Or, if you are using [NPM](https://npm.im/), install it |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install @patternfly/elements |
| 19 | +``` |
| 20 | + |
| 21 | +Then once installed, import it to your application: |
| 22 | + |
| 23 | +```js |
| 24 | +import '@patternfly/elements/pf-hint/pf-hint.js'; |
| 25 | +``` |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +### Default with no title |
| 30 | + |
| 31 | +Basic hint without a title, used for simple informational messages. |
| 32 | + |
| 33 | +```html |
| 34 | +<pf-hint> |
| 35 | + Welcome to the new documentation experience. |
| 36 | + <a href="#">Learn more about the improved features</a>. |
| 37 | +</pf-hint> |
| 38 | +``` |
| 39 | + |
| 40 | +### Hint with title |
| 41 | + |
| 42 | +Add a title to your hint to provide more context to the user. |
| 43 | + |
| 44 | +```html |
| 45 | +<pf-hint> |
| 46 | + <span slot="title">Do more with Find it Fix it capabilities</span> |
| 47 | + Upgrade to Red Hat Smart Management to remediate all your systems across regions and geographies. |
| 48 | +</pf-hint> |
| 49 | +``` |
| 50 | + |
| 51 | +### Hint with footer |
| 52 | + |
| 53 | +```html |
| 54 | +<pf-hint> |
| 55 | + <span slot="title">Do more with Find it Fix it capabilities</span> |
| 56 | + Upgrade to Red Hat Smart Management to remediate all your systems across regions and geographies. |
| 57 | + <pf-button slot="footer" variant="link" inline> |
| 58 | + <a href="#">Try it for 90 days</a> |
| 59 | + </pf-button> |
| 60 | +</pf-hint> |
| 61 | +``` |
| 62 | + |
| 63 | +### Hint with actions |
| 64 | + |
| 65 | +```html |
| 66 | +<pf-hint> |
| 67 | + <pf-dropdown slot="actions"> |
| 68 | + <pf-button slot="toggle" plain aria-label="Actions"> |
| 69 | + <pf-icon icon="ellipsis-v"></pf-icon> |
| 70 | + </pf-button> |
| 71 | + <pf-dropdown-menu> |
| 72 | + <pf-dropdown-item> |
| 73 | + <a href="#">Link</a> |
| 74 | + </pf-dropdown-item> |
| 75 | + <pf-dropdown-item> |
| 76 | + <button type="button">Action</button> |
| 77 | + </pf-dropdown-item> |
| 78 | + </pf-dropdown-menu> |
| 79 | + </pf-dropdown> |
| 80 | + <span slot="title">Do more with Find it Fix it capabilities</span> |
| 81 | + Upgrade to Red Hat Smart Management to remediate all your systems across regions and geographies. |
| 82 | +</pf-hint> |
| 83 | +``` |
| 84 | + |
| 85 | +## Slots |
| 86 | + |
| 87 | +- `(default)` – Body content of the hint. |
| 88 | +- `title` – Optional title that appears above the body copy. |
| 89 | +- `footer` – Optional footer content, typically links or buttons. |
| 90 | +- `actions` – Optional actions menu (for example, a kebab dropdown in the top-right corner). |
| 91 | + |
| 92 | +## CSS Custom Properties |
| 93 | + |
| 94 | +- `--pf-c-hint--BackgroundColor` – Background color (`var(--pf-global--palette--blue-50, #e7f1fa)`). |
| 95 | +- `--pf-c-hint--BorderColor` – Border color (`var(--pf-global--palette--blue-100, #bee1f4)`). |
| 96 | +- `--pf-c-hint--BorderWidth` – Border width (`1px`). |
| 97 | +- `--pf-c-hint--BorderRadius` – Border radius (`var(--pf-global--BorderRadius--sm, 3px)`). |
| 98 | +- `--pf-c-hint--PaddingTop/Right/Bottom/Left` – Padding around the container (`var(--pf-global--spacer--lg, 1.5rem)`). |
| 99 | +- `--pf-c-hint__title--FontSize` – Title font size (`1.125rem`). |
| 100 | +- `--pf-c-hint__title--FontWeight` – Title font weight (`var(--pf-global--FontWeight--semi-bold, 700)`). |
| 101 | +- `--pf-c-hint__body--FontSize` – Body font size (`1rem`). |
| 102 | +- `--pf-c-hint__body--Color` – Body text color (`var(--pf-global--Color--100, #151515)`). |
| 103 | +- `--pf-c-hint__footer--child--MarginRight` – Spacing between footer children (`1rem`). |
| 104 | +- `--pf-c-hint__actions--c-dropdown--MarginTop` – Offset for dropdown actions (`calc(0.375rem * -1)`). |
| 105 | + |
| 106 | +## CSS Parts |
| 107 | + |
| 108 | +- `container` |
| 109 | +- `title` |
| 110 | +- `body` |
| 111 | +- `footer` |
| 112 | +- `actions` |
0 commit comments