# Aave Pro Toolbar

A container for grouping a set of buttons and controls.

Build a Toolbar in this project that looks and behaves like Aave Pro's. Measured from the running Aave Pro app (pro.aave.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or [Base UI](https://base-ui.com/react/components/toolbar) if it has none.

Fidelity: Partly measured from Aave Pro's CSS and computed styles. No reference has been captured yet.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--fg-1` | `#000` | `#fff` |
| `--fg-3` | `#7d7d7d` | `#8f8e8e` |
| `--fg-4` | `#a8a8a8` | `#636161` |
| `--bg-2` | `#fcfcfc` | `#1a1919` |
| `--bg-3` | `#fff` | `#1f1e1e` |
| `--border-1` | `#00000014` | `#ffffff14` |
| `--border-2` | `#0000001a` | `#ffffff1f` |
| `--sunken-1` | `#f2f2f2` | `#0006` |
| `--focus-color` | `#007aff80` | `#007aff80` |
| `--font-regular` | `"Aave Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif` | `"Aave Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif` |
| `--font-size-mini` | `0.75rem` | `0.75rem` |
| `--font-weight-normal` | `400` | `400` |
| `--font-weight-medium` | `500` | `500` |
| `--radius-rounded` | `9999px` | `9999px` |

## CSS

Scoped under `[data-style="aave"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="aave"] {
  .ui-toolbar {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border-1);
    border-radius: 0.625rem;
    background-color: var(--bg-2);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px #0000001f;
    color: var(--fg-3);
    font-family: var(--font-regular);
    font-size: var(--font-size-mini);

    &[data-orientation="vertical"] {
      flex-direction: column;
      align-items: stretch;
    }
  }

  .ui-toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;

    &[data-orientation="vertical"] {
      flex-direction: column;
      align-items: stretch;
    }
  }

  .ui-toolbar-button {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 28px;
    min-width: 28px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 0.4375rem;
    background: transparent;
    color: var(--fg-3);
    font-family: inherit;
    font-size: var(--font-size-mini);
    font-weight: var(--font-weight-medium);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
    touch-action: manipulation;
    transition-property: color, background-color, border-color;
    transition-duration: 0.12s;
    transition-timing-function: ease-out;

    &:focus-visible {
      outline: 2px solid var(--focus-color);
      outline-offset: 1px;
    }

    @media (hover: hover) {
      &:hover:not([data-disabled]) {
        background: var(--bg-3);
        color: var(--fg-1);
      }
    }

    &:is([data-popup-open], [data-pressed], [aria-pressed="true"]) {
      border-color: var(--border-1);
      background: var(--bg-3);
      color: var(--fg-1);
    }

    &[data-disabled] {
      opacity: 0.3;
      cursor: not-allowed;
    }

    & svg {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
    }
  }

  .ui-toolbar-input {
    box-sizing: border-box;
    height: 28px;
    min-width: 0;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-rounded);
    background-color: var(--sunken-1);
    color: var(--fg-1);
    font-family: inherit;
    font-size: var(--font-size-mini);
    font-weight: var(--font-weight-normal);
    outline: none;
    transition: box-shadow 0.2s;

    &::placeholder {
      color: var(--fg-4);
    }

    &:focus {
      box-shadow: 0 0 0 1px var(--border-2);
    }

    &[data-disabled] {
      opacity: 0.3;
    }
  }

  .ui-toolbar-separator {
    flex-shrink: 0;
    border: 0 solid var(--border-1);

    &[data-orientation="vertical"] {
      align-self: stretch;
      width: 0;
      margin: 0 6px;
      border-left-width: 1px;
    }

    &[data-orientation="horizontal"] {
      height: 0;
      margin: 6px 0;
      border-bottom-width: 1px;
    }
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";

const join = (base: string, extra?: string) => (extra ? `${base} ${extra}` : base);

function Root({ className, ...props }: Omit<BaseToolbar.Root.Props, "className"> & { className?: string }) {
  return <BaseToolbar.Root className={join("ui-toolbar", className)} {...props} />;
}

function Group({ className, ...props }: Omit<BaseToolbar.Group.Props, "className"> & { className?: string }) {
  return <BaseToolbar.Group className={join("ui-toolbar-group", className)} {...props} />;
}

function Button({ className, ...props }: Omit<BaseToolbar.Button.Props, "className"> & { className?: string }) {
  return <BaseToolbar.Button className={join("ui-toolbar-button", className)} {...props} />;
}

function Link({ className, ...props }: Omit<BaseToolbar.Link.Props, "className"> & { className?: string }) {
  return <BaseToolbar.Link className={join("ui-toolbar-button", className)} {...props} />;
}

function Input({ className, ...props }: Omit<BaseToolbar.Input.Props, "className"> & { className?: string }) {
  return <BaseToolbar.Input className={join("ui-toolbar-input", className)} {...props} />;
}

function Separator({ className, ...props }: Omit<BaseToolbar.Separator.Props, "className"> & { className?: string }) {
  return <BaseToolbar.Separator className={join("ui-toolbar-separator", className)} {...props} />;
}

export const Toolbar = {
  Root,
  Group,
  Button,
  Link,
  Input,
  Separator,
};
```

## Example

```tsx
import { Toolbar } from "@replicas/ui";

export default function ToolbarDemo() {
  return (
    <Toolbar.Root aria-label="Selected files">
      <span style={{ padding: "0 8px 0 6px", color: "var(--surface-text-muted)" }}>2 selected</span>
      <Toolbar.Separator />
      <Toolbar.Group aria-label="Actions">
        <Toolbar.Button>Download</Toolbar.Button>
        <Toolbar.Button>Share</Toolbar.Button>
        <Toolbar.Button>Copy</Toolbar.Button>
        <Toolbar.Button>Rename</Toolbar.Button>
      </Toolbar.Group>
      <Toolbar.Separator />
      <Toolbar.Button>Move to folder</Toolbar.Button>
    </Toolbar.Root>
  );
}
```

## Foundations

The rest of the Aave Pro style, as a skill: https://replicas.raphaelsalaja.com/skills/aave/SKILL.md