# API of `@koobiq/components/alert`

Documented on [Alert](https://koobiq.io/en/components/alert.md). NgModule: `KbqAlertModule`.

## Components

### KbqAlert (component)

Shows important information on a page. Can carry a hint, signal a status change, or indicate a problem.

```html
<kbq-alert [alertColor]="'error'" [alertStyle]="'colored'">Something went wrong</kbq-alert>
```

For a dynamically inserted alert, add `role="alert"` (or `aria-live`) on the host so assistive
technology announces it — see the component guide.

```ts
@Component({ selector: 'kbq-alert', exportAs: 'kbqAlert' })
class KbqAlert {
    readonly compact = input<boolean>(false);
    readonly alertStyle = input<KbqEnumValues<KbqAlertStyles>>(
        KbqAlertStyles.Default
    );
    readonly alertColor = input<"error" | "warning" | "success" | "info">(
        KbqAlertColors.Info
    );
    readonly closed = output<void>();
}
```

- `[compact]`: `boolean` — Whether the alert uses the denser compact size.
- `[alertStyle]`: `KbqEnumValues<KbqAlertStyles>` — Visual style — neutral `default` or the attention-drawing `colored` background.
- `[alertColor]`: `"error" | "warning" | "success" | "info"` — Status of the alert. Drives the background in the `colored` style and auto-tints an uncolored
  projected status icon to the matching color (`info` icons become `contrast`). Defaults to `'info'`.
- `(closed)`: `void` — Emitted when the projected close control is activated. The consumer is responsible for hiding the alert.

## Directives

### KbqAlertCloseButton (directive)

Marks the projected close control (place it on a native `<button>` with an accessible name).

```ts
@Directive({
    selector: '[kbq-alert-close-button]',
    exportAs: 'kbqAlertCloseButton'
})
class KbqAlertCloseButton {}
```

### KbqAlertControl (directive)

Marks a projected action control (link or button) shown in the alert's button stack.

```ts
@Directive({ selector: '[kbq-alert-control]', exportAs: 'kbqAlertControl' })
class KbqAlertControl {}
```

### KbqAlertTitle (directive)

Marks the projected alert heading.

```ts
@Directive({ selector: '[kbq-alert-title]', exportAs: 'kbqAlertTitle' })
class KbqAlertTitle {}
```

## Enums

### KbqAlertColors (enum)

Status conveyed by an alert. Drives the background (colored style) and the auto-tinted status icon.

```ts
enum KbqAlertColors {
    Error = 'error',
    Warning = 'warning',
    Success = 'success',
    Info = 'info'
}
```

### KbqAlertStyles (enum)

Visual style of an alert.

```ts
enum KbqAlertStyles {
    Default = 'default',
    Colored = 'colored'
}
```

- `Default`: `'default'` — Neutral background; the status is conveyed by the icon color only.
- `Colored`: `'colored'` — Colored background matching the status — use to draw attention when a default alert gets lost on screen.
