Skip to content

Label

A styled native label.

View as Markdown

Example

Installation

npx fizzy-ui add label

Copies label.ts into src/app/ui/ and installs what it needs. Run init once first.

Accessibility

No axe-core violations axe-core 4.14.0 checks this example, closed and with its panels open, on every build; the site is not published otherwise.

Source

The exact file add copies. It is yours to edit.

label.ts
import { Directive } from '@angular/core';

/** Dims when its control is disabled: the control is inside the label or right after it. */
@Directive({
  selector: 'label[fzLabel]',
  host: {
    class: 'flex select-none items-center gap-2 text-sm font-medium leading-none [&:has(:disabled,+:disabled)]:cursor-not-allowed [&:has(:disabled,+:disabled)]:opacity-50',
  },
})
export class FzLabel {}

export const FZ_LABEL = [FzLabel] as const;