# Trustwell UI JavaScript WebComponents Documentation

This documentation provides a detailed outline of the custom JavaScript WebComponents used in this project and the associated attributes for each component.

## Table of Contents

- [TuiAlert](#TuiAlert)
- [TuiSection](#TuiSection)
- [TuiCard](#TuiCard)

---

## <a href="#TuiAlert">TuiAlert</a>

**Description:** A customizable alert component with configurable severity levels (e.g., info, warning, ...) and
flexible duration settings. It also provides a slot for adding a custom description or further information.

| Attribute     | Description                                                                                            | Required / Optional | Accepted Values                        |
| ------------- | ------------------------------------------------------------------------------------------------------ | ------------------- | -------------------------------------- |
| heading       | The heading for the alert.                                                                             | Required            | String                                 |
| level         | The level of the alert styling.                                                                        | Required            | "success", "info", "warning", "danger" |
| close-title   | The title for the close button. If set displays a close button and a close link button.                | Optional            | String                                 |
| close-persist | Sets duration of close button. **Note:** ID is required when setting close persist.                    | Optional            | "session", "local"                     |
| id            | A unique identifier to put into session or local storage.                                              | Optional            | String                                 |
| alert-width   | An optional value that removes the link close button and reduces the alert width to its minimum width. | Optional            | "fit-width"                            |

### Usage

```HTML
<tui-alert heading="Heading" level="info" close-title="Title" close-persist="session" id="unique value" alert-width="fit-content">
  <span slot="message">Description or more info</span>
</tui-alert>
```

---

## <a href="#TuiSection">TuiSection</a>

**Description:** A container with a heading for other components. It provides a slot for adding content.

| Attribute     | Description                                                                    | Required / Optional | Accepted Values |
| ------------- | ------------------------------------------------------------------------------ | ------------------- | --------------- |
| heading       | The heading for the section.                                                   | Optional            | String          |
| id            | The id for the section.                                                        | Optional            | String          |
| scroll-offset | Sets the offset position that the section scrolls to from the top of the view. | Optional            | Number String   |

### Usage

```HTML
<tui-section heading="Test Heading" id="test-section" scroll-offset="10">
  <tui-input slot="content" label="Title" subtitle="subtitle" placeholder="placeholder" search="true"></tui-input>
  <tui-input slot="content" label="Title"></tui-input>
  <button slot="content">Button</button>
</tui-section>
```

## <a href="#TuiCard">TuiCard</a>

**Description:** A card with a title, optional description, optional link or description and a container for an image.

| Attribute     | Description                                                                                       | Required / Optional | Accepted Values |
| ------------- | ------------------------------------------------------------------------------------------------- | ------------------- | --------------- |
| title         | The title for the component.                                                                      | Optional            | String          |
| description   | An optional description.                                                                          | Optional            | String          |
| detail-text   | Text for an optional link or button.                                                              | Optional            | String          |
| detail-target | An optional link or button target. If it starts with "http" it will be a link otherwise a button. | Optional            | String          |
| selected      | Adds a color border and a check mark if present.                                                  | Optional            | selected        |

Note: If detail-text is set, detail-link is required and vice versa.

### Usage

```HTML
<tui-card title="Standard Vertical" description="Use this template whenever possible." detail-text="Text" detail-target="http://#" selected></tui-card>
```
