# Components

What to install and which providers to mount before using Telescope components.

Tabs: [Overview](/components/web/overview/overview.overview.md) · [Setup](/components/web/overview/overview.setup.md)

## Installation

`@pleo-io/telescope` is a restricted package hosted on GitHub Packages. Point the `@pleo-io` scope at its registry in your project's `.npmrc`:

```ini
@pleo-io:registry=https://npm.pkg.github.com
```

The registry setting does not authenticate you. For local installs, use a GitHub personal access token (classic) with `read:packages` and access to the package. Authorize it for Pleo's SSO if required. Keep credentials out of the project: your **user-local** `~/.npmrc` can reference an environment variable supplied securely by your shell or credential manager:

```ini
# ~/.npmrc — do not commit this file or put the token value in application code
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
```

Provide `NODE_AUTH_TOKEN` in your environment, then install Telescope with its peer dependencies:

```bash
pnpm add @pleo-io/telescope styled-components@^6.1.6 react-router@^7.0.0
```

Install React and React DOM 19.x in the host application. The icons, illustrations and tokens packages are runtime dependencies of Telescope and are installed automatically; list them explicitly only if you import them directly.

***

## App root

Mount `TelescopeProvider` and `GlobalStyle` once, at the root of your app:

```tsx
import {GlobalStyle, TelescopeProvider} from '@pleo-io/telescope'

import {translations} from './telescope-translations'

export const App = ({children}: {children: React.ReactNode}) => (
    <TelescopeProvider translations={translations}>
        <GlobalStyle />
        {children}
    </TelescopeProvider>
)
```

- `TelescopeProvider` loads the design token CSS, supplies the translated screen-reader labels that components render (e.g. a modal's close button), and shares one tooltip context so moving between tooltips skips the open delay. Without it, labels fall back to English and each tooltip gets its own context.
- `translations` takes every label in your user's language. Pass `__dummyTelescopeProviderTranslations` for the English defaults, e.g. in tests or internal tools.
- `GlobalStyle` adds the CSS reset, fonts and reduced-motion handling. Skip it in Tailwind apps (see [Using alongside Tailwind](#using-alongside-tailwind)).

***

## Providers some components need

| Component                        | Needs                                                                                                                                                                                                 |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Toast`, `FileInput`, `Filedrop` | `ToasterProvider` around the app and one `<Toaster />` inside it. Without them `useToaster().showToast` does nothing, so `FileInput` and `Filedrop` reject invalid files without telling the user why |
| `ActionBanner`                   | A React Router 7 `<Router>`: its links render React Router's `Link`                                                                                                                                   |

```tsx
import {Toaster, ToasterProvider} from '@pleo-io/telescope'

export const Toasts = ({children}: {children: React.ReactNode}) => (
    <ToasterProvider>
        {children}
        <Toaster isLoggedIn={false} isNavigationVisible={false} navigationWidth={0} />
    </ToasterProvider>
)
```

`Toaster` offsets toasts past your app's side navigation when `isLoggedIn` and `isNavigationVisible` are both true, by `navigationWidth` pixels. Pass `false` and `0` without one.

***

## Dark mode

Light tokens apply at `:root`. Add the `js-telescope-color-scheme-dark` class to an element (e.g. `<html>`) to switch it and everything inside it to the dark color scheme.

***

## Per-component imports

Each component folder is also exposed as its own subpath, named after the folder. `GlobalStyle` and the design tokens have subpaths too. Use these to depend on a single component without the rest of the library:

```tsx
import {PleoLogo} from '@pleo-io/telescope/pleo-logo'
import {TelescopeProvider} from '@pleo-io/telescope/provider'
import {GlobalStyle} from '@pleo-io/telescope/global-style'
import {tokens} from '@pleo-io/telescope/tokens'
```

The root import is tree-shakeable too: a bundler such as Vite, Rollup or webpack includes only the components you import, whichever path you use.

***

## Using alongside Tailwind

In an app styled with Tailwind v4, mount `TelescopeProvider` but not `GlobalStyle`:

- `TelescopeProvider` supplies the translated screen-reader labels and the shared tooltip context. Without it, labels fall back to English. `Tooltip` still renders, but each tooltip gets its own provider, so moving between tooltips doesn't skip the open delay.
- `Reset` is unlayered, so its element rules (for example `margin: 0` on headings, `padding: 0` on lists) beat every Tailwind utility. Tailwind's Preflight already covers the same base reset, but not `Reset`'s reduced-motion override. Add the rule below to your base layer, so animations and transitions, including Telescope's own such as `Tooltip`'s slide-in, stop for users who ask for reduced motion. The `!important` declarations still beat Telescope's unlayered component styles.
- `Fonts` only sets the body font and font smoothing. Use the font tokens and `@pleo-io/telescope-tokens/fonts.css` instead (see the [tokens README](https://github.com/pleo-io/web/tree/main/published-packages/telescope-tokens)), and add Tailwind's `antialiased` class to `<body>` to match the smoothing.

```css
@layer base {
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
            scroll-behavior: auto !important;
        }
    }
}
```
