@arlioz/flagship-vue
v5.1.0
Published
Official Vue SDK for FlagShip — feature flags for startups
Maintainers
Readme
Install
npm install @arlioz/flagship-vue @arlioz/flagship
@arlioz/flagshipandvue>= 3.3.0 are peer dependencies.
Quick Start
1. Install the plugin
import { createApp } from 'vue'
import { createFlagShip } from '@arlioz/flagship-vue'
import App from './App.vue'
const app = createApp(App)
app.use(
createFlagShip({
apiKey: 'flg_production_...',
baseUrl: 'https://your-api.com/api',
}),
)
app.mount('#app')2. Use flags in components
<script setup>
import { useFlag } from '@arlioz/flagship-vue'
const darkMode = useFlag('dark-mode', false)
</script>
<template>
<DarkTheme v-if="darkMode" />
<LightTheme v-else />
</template>API
Composables
| Composable | Return | Description |
| -------------------------------- | ---------------------------------- | ---------------------------------- |
| useFlag<T>(key, defaultValue?) | ComputedRef<T> | Single flag as reactive ref |
| useFlags() | ComputedRef<Record<string, any>> | All flags |
| useFlagShipLoading() | ComputedRef<boolean> | True during initial fetch |
| useFlagShipClient() | FlagShip | Client instance for imperative use |
Identify users
const client = useFlagShipClient()
await client.identify('user-42', { plan: 'pro' })Compatibility
- Vue >= 3.3.0
License
MIT — Arlioz
