# Shapes

A shape is the form of an object. Shapes are used to identify components, direct attention to them, and express brand.

## Usage

Element is primarily comprised of circles and rounded rectangles. A set of standard shapes and sizes is used across the system. Shapes are an essential component of the Element brand.

### Rounded rectangles

Rounded rectangles maintain a rectangular shape with softened corners. The corner radius varies depending on the element:

- `2px radius`: Used for subtle softness while retaining a rectangular look, such as in buttons and inputs.
- `4px radius`: The default for container elements like cards.
- `100% radius` (fully rounded): Used for pill-shaped elements, like badges.

![Shapes - rounded rectangles](<../images/shapes-rounded.png>)

### Circles

Circle shapes are used in multiple places like lists, notifications, and avatars.

![Circles](<../images/shapes-circles.png>)

## Specification

### Tokens

| Token | Radius |
| --- | --- |
| `$element-radius-0` | `0px` |
| `$element-radius-1` | `2px` |
| `$element-radius-2` | `4px` |
| `$element-radius-3` | `8px` |

Radius is set for all 4 sides unless specified otherwise.

## Code

All Element shape variants are accessible as `rounded-` CSS utility classes, see [border radius](<https://element.siemens.io/fundamentals/styles/borders/#radius>).

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component } from '@angular/core';

@Component({
  selector: 'app-sample',
  templateUrl: './shapes.html',
  styles: `
    :host {
      .example {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
        margin-block-end: 1rem;
      }
      span {
        padding: 2rem;
        background-color: var(--si-sys-color-background-information-subtle);
      }
    }
  `,
  host: {
    class: 'p-5'
  }
})
export class SampleComponent {}
```

Template:

```html
<h3>Add rounded corners</h3>
<div class="example">
  <span class="rounded">rounded</span>
  <span class="rounded-top">rounded-top</span>
  <span class="rounded-end">rounded-end</span>
  <span class="rounded-bottom">rounded-bottom</span>
  <span class="rounded-start">rounded-start</span>
</div>
<h3>Customize rounded corner radius</h3>
<div class="example">
  <span class="rounded-0">rounded-0 - 0px</span>
  <span class="rounded-1">rounded-1 - 4px</span>
  <span class="rounded-2">rounded-2 - 8px</span>
  <span class="rounded-circle">rounded-circle - 50%</span>
  <span class="rounded-pill">rounded-pill - 50rem</span>
</div>
```

### Sass variables

The shape tokens for each Element shape can also be alternatively used as SCSS variables within stylesheets.

```
@use '@siemens/element-theme/src/styles/variables';

border-radius: variables.$element-radius-0;
border-radius: variables.$element-radius-1;
border-radius: variables.$element-radius-2;
border-radius: variables.$element-radius-3;
```
