Skip to content

Configuration

Vue Ecosphere exposes two ways to set defaults: a global plugin option and a scoped <EpConfigProvider> component. They share the same shape, and the provider always wins inside its subtree.

Global defaults (plugin options)

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

createApp(App)
	.use(Ecosphere, {
		size: "md",          // "xs" | "sm" | "md" | "lg" | "xl"
		hue: "primary",      // EpHue (see below)
		locale: "en-US",
	})
	.mount("#app");

Anything you set here becomes the default value of the corresponding prop on every Ep* component. Components still accept explicit overrides.

Scoped defaults (<EpConfigProvider>)

When part of your app needs different defaults — for example, a marketing surface that uses larger inputs — wrap it in a provider:

vue
<template>
	<EpConfigProvider :size="'lg'" :hue="'accent'">
		<HeroForm />
	</EpConfigProvider>
</template>

Providers nest. The deepest one wins.

EpHue palette

The library's color contract is eight hues, each backed by semantic tokens:

HueUse case
primaryDefault action color
accentSecondary brand color
neutralGreyscale / muted controls
infoInformational status
successPositive status
warningCautionary status
dangerDestructive / error
systemOS-level interactions

Hues are exposed as --ep-color-{hue}-{role} tokens. See Theming.

EpSize scale

Tokenpx (default)Notes
xs24Inline / dense
sm32Sidebar controls
md40Default
lg48Hero forms
xl56Display

Size affects height, font-size, and padding — never spacing between components.

Reading config in your own components

ts
import { useEpConfig } from "vue-ecosphere";

const config = useEpConfig();
// config.size.value, config.hue.value, config.locale.value

The composable returns reactive refs so your component re-renders when defaults change.

Released under the MIT License. Built with VitePress.