Skip to content

Update AppHeader docs with Application Title content #2968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: jt/application-title/hds-4866
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ The `AppHeader::HomeLink` component uses the generic `Hds::Interactive` componen
<C.Property @name="icon" @type="string" @required={{true}}>
Used to show an icon. Any [icon](/icons/library) name is accepted. [See guidance on which icon to use depending on the product](/components/app-header#home-link).
</C.Property>
<C.Property @name="text" @type="string" @required={{true}}>
Used to display text inline with the logo. If `@isIconOnly` is set to false, this value will also be passed to the `aria-label` of the `<a>` tag.
</C.Property>
<C.Property @name="isIconOnly" @type="boolean" @default="false">
Indicates if the Home Link will only contain a icon/logo, or if the `@text` property will be rendered adjacent to the logo.
</C.Property>
<C.Property @name="color" @type="string">
Used to specify an optional custom color provided as any valid CSS color. For more details on acceptable values, see the [Icon color argument](/components/icon?tab=code#fill). If unspecified, it will use the App Headers’s default white text color.
</C.Property>
Expand All @@ -65,9 +71,6 @@ The `AppHeader::HomeLink` component uses the generic `Hds::Interactive` componen
<C.Property @name="isRouteExternal" @type="boolean" @default="false">
This controls whether the “LinkTo” is external to the Ember engine, in which case it will use a `<LinkToExternal>` for the `@route`.
</C.Property>
<C.Property @name="ariaLabel" @type="string" @required={{true}}>
The value of the aria-label. If no text value is defined, an error will be thrown.
</C.Property>
<C.Property @name="...attributes">
This component supports use of [`...attributes`](https://guides.emberjs.com/release/in-depth-topics/patterns-for-components/#toc_attribute-ordering).
</C.Property>
Expand Down
30 changes: 25 additions & 5 deletions website/docs/components/app-header/partials/code/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ When adding Dropdown components within the App Header, be sure to set `enableCol

The `Hds::AppHeader::HomeLink` child component should be yielded within the `<:logo>` block. It provides consistent branding and navigates the user to the “home” or main dashboard page.

It requires a value for the `@icon` and `@ariaLabel` arguments.
It requires a value for the `@icon` and `@text` arguments.

It is built on top of the [`Hds::Interactive` component](/utilities/interactive), so it accepts all its routing arguments (eg. `@href`, `@route`, `@query`, `@model(s)`, etc.).

Expand All @@ -68,7 +68,7 @@ probably need to be set to `true` (or omitted to rely on defaults)
<:logo>
<Hds::AppHeader::HomeLink
@icon="hashicorp"
@ariaLabel="HashiCorp home menu"
@text="HashiCorp home menu"
@href="/"
/>
</:logo>
Expand All @@ -84,6 +84,26 @@ probably need to be set to `true` (or omitted to rely on defaults)
</Hds::AppHeader>
```

When `@isIconOnly` is set to `false`, the `@text` argument displays text inline with the logo and can be used to more deliberately title an application or provide other differentiating text.

```handlebars
<Hds::AppHeader @hasA11yRefocus={{false}}>
<:logo>
<Hds::AppHeader::HomeLink
@icon="terraform"
@text="Admin Console"
@isIconOnly={{false}}
@href="/"
/>
</:logo>

<:utilityActions>
<Doc::Placeholder @height="2em" @width="auto" @text="HelpMenu" @background="#e4e4e4" />
<Doc::Placeholder @height="2em" @width="auto" @text="UserMenu" @background="#e4e4e4" />
</:utilityActions>
</Hds::AppHeader>
```

The `HomeLink` also accepts optional arguments; for example, it’s possible to provide a custom color for the icon if needed:

```handlebars
Expand All @@ -95,7 +115,7 @@ probably need to be set to `true` (or omitted to rely on defaults)
<:logo>
<Hds::AppHeader::HomeLink
@icon="terraform"
@ariaLabel="Terraform home menu"
@text="Terraform home menu"
@color="var(--token-color-terraform-brand)"
@href="/"
/>
Expand Down Expand Up @@ -125,7 +145,7 @@ probably need to be set to `true` (or omitted to rely on defaults)
<:logo>
<Hds::AppHeader::HomeLink
@icon="hashicorp"
@ariaLabel="HashiCorp home menu"
@text="HashiCorp home menu"
@href="/"
/>
</:logo>
Expand Down Expand Up @@ -159,7 +179,7 @@ probably need to be set to `true` (or omitted to rely on defaults)
<:logo>
<Hds::AppHeader::HomeLink
@icon="hashicorp"
@ariaLabel="HashiCorp home menu"
@text="HashiCorp home menu"
@href="/"
/>
</:logo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ For cloud products, the icon should always be `hcp`. For standalone or open-sour

![Examples of the Home link using different logos](/assets/components/app-header/app-header-home-link.png)

#### Text

The home link supports an optional `text` property to more explicitly title an application. We recommend using this property sparingly as it's often unnecessary to title a HashiCorp application in such an explicit manner.

![Example of text displayed in the Home Link that reads Admin UI](/assets/components/app-header/app-header-home-link-text.png)

### Context switcher

!!! Info
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.