Simple API
Fetch flags via a small, promise-based SDK with great TypeScript types.
Tiny, typed, framework-friendly (React & Vue)
Install the package, then choose the style you prefer. You can instantiate Beam directly or use the singleton via beam().
import { Beam, beam } from '@beacon-hq/beam';
window.Beam = new Beam();
const active = await window.Beam.active('new-ui');
// OR: use the singleton
const val = await beam().value<string>('experiment', 'control');
import { useFeatureFlag } from '@beacon-hq/beam/react';
function Component() {
const { status, value, loading } = useFeatureFlag<string>('experiment', { defaultValue: 'control' });
if (loading) return <span>Loading…</span>;
return <div>{status ? `Variant: ${value}` : 'Feature Off'}</div>;
}
<script setup lang="ts">
import { useFeatureFlag } from '@beacon-hq/beam/vue';
const { status, value, loading } = useFeatureFlag<string>('experiment', { defaultValue: 'control' });
</script>
<template>
<span v-if="loading">Loading…</span>
<div v-else>
<template v-if="status">Variant: {{ value }}</template>
<template v-else>Feature Off</template>
</div>
</template>
npm install @beacon-hq/beam
# or
pnpm add @beacon-hq/beam
# or
yarn add @beacon-hq/beam
Beam is a small TypeScript library for fetching and using Laravel Pennant feature flags in your frontend. It exposes a minimal core SDK and thin adapters for React and Vue.