# Getting started

Source: https://ecosphere.dev/docs/guide/getting-started (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

Ecosphere is blue on cool slate: one accent family, quiet surfaces, and figures that never shift. It ships for Vue and for React with the same components, markup and stylesheet. Install the package for your framework, load the stylesheet once, and build with the components.

Pick your framework with the switch at the top of the page: code samples, API tables and imports follow it.

## Install

The peer dependency is Vue 3.5 or later for vue-ecosphere, and React 18.2 or 19 for react-ecosphere. The fonts (Google Sans, Fraunces) and the RemixIcon set ship inside the package: no CDN links to add.

Vue (vue-ecosphere):

```vue
npm install vue-ecosphere
```

React (react-ecosphere):

```tsx
npm install react-ecosphere
```

## Set up the app

Import the stylesheet once, where you control its place in your CSS order. In Vue, the plugin registers every component as Eco… (EcoButton, EcoTextField…). In React, import components where you use them, and mount <EcoToaster /> (and <EcoConfirmHost /> if you use useConfirm) once near the root.

Vue (vue-ecosphere):

```vue
// main.ts
import { createApp } from "vue";
import Ecosphere from "vue-ecosphere";
import "vue-ecosphere/styles.css";
import App from "./App.vue";

createApp(App).use(Ecosphere).mount("#app");
```

React (react-ecosphere):

```tsx
// main.tsx
import { createRoot } from "react-dom/client";
import "react-ecosphere/styles.css";
import App from "./App";

createRoot(document.getElementById("root")!).render(<App />);

// App.tsx
import { EcoButton, EcoConfirmHost, EcoToaster } from "react-ecosphere";

export default function App() {
  return (
    <>
      <EcoButton variant="primary" icon="checkbox-circle-line">Ready</EcoButton>
      <EcoToaster />
      <EcoConfirmHost />
    </>
  );
}
```

## Import per component

Prefer tree-shaking? Turn off global registration and import components where you use them.

```
// Register nothing globally and import what you use
app.use(Ecosphere, { components: false });

// SomePage.vue
import { EcoButton, EcoTextField } from "vue-ecosphere";
```

## Use the classes without a framework

Every component is plain HTML with BEM classes on design tokens. The Vue and React components render exactly that markup, so the stylesheet works on its own in any stack.

Vue (vue-ecosphere):

```vue
<!-- Any framework, or none: the classes are the system -->
<link rel="stylesheet" href="node_modules/vue-ecosphere/dist/ecosphere.css">

<button class="btn btn--primary" type="button">
  <i class="ri-add-line" aria-hidden="true"></i>New request
</button>
```

React (react-ecosphere):

```tsx
<!-- Any framework, or none: the classes are the system -->
<link rel="stylesheet" href="node_modules/vue-ecosphere/dist/ecosphere.css">

<button class="btn btn--primary" type="button">
  <i class="ri-add-line" aria-hidden="true"></i>New request
</button>
```

## Rules that keep screens calm

- One primary button per region. A danger button is that primary.
- Status colour reaches the screen only through badges, scores, toasts and notices.
- Numbers always use the UI face with tabular figures, never the display serif.
- Pair every disabled control with text that says why.
- Write labels in sentence case, and name the consequence on destructive actions.
