# `AgentXM.Examples.TinyFlags.VariantFlag`
[🔗](https://github.com/agentxm/polyglot-examples/blob/main/lib/agentxm_example_tinyflags/variant_flag.ex#L1)

A feature flag whose treatment is one of a fixed set of named variants.

Variants are listed in declaration order. Without `:default` the first
variant is the default. Without `:rollout` the default variant is returned
for every caller. With `:rollout`, percentages of traffic are allocated to
variants by deterministic bucketing; the total must not exceed 100, every
rollout key must be a declared variant, and each percentage must be in
`0..100`.

# `t`

```elixir
@type t() :: %AgentXM.Examples.TinyFlags.VariantFlag{
  default: String.t(),
  rollout: %{optional(String.t()) =&gt; 0..100} | nil,
  variants: [String.t(), ...]
}
```

# `new`

```elixir
@spec new(
  [String.t(), ...],
  keyword()
) :: {:ok, t()} | {:error, term()}
```

Construct a variant flag.

`variants` is a non-empty list of non-empty, unique strings.

Options:

  * `:default` — default variant (must be one of `variants`).
  * `:rollout` — map of `variant => percentage` allocating traffic.

# `new!`

```elixir
@spec new!(
  [String.t(), ...],
  keyword()
) :: t()
```

Like `new/2` but raises `ArgumentError` on invalid input.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
