Overview
ds-plan is a simple self-contained Web Component for showing a Soracom plan tag. The component will sanitize the plan text, and display the correctly formatted official plan name and color.
Options
Simply include the plan name inside the ds-plan element, or use the plan="" attribute.
Plan lookup ignores case, whitespace, punctuation, and an optional leading plan. We recommend using either:
<ds-plan>[plan name]</ds-plan>
<ds-plan plan="[plan name]"></ds-plan>
Inline usage
The ds-plan component can be used inline within text, automatically matching the surrounding font size.
Sizing
Bundle
You can include a bundle label by combining a plan key or alias with one of its registered bundle keys. For example, du and 50gb combine to form du50gb. Both of these forms resolve to plan-DU with its 50GB bundle label:
Alternatively, you can use the bundle attribute to specify a custom bundle label. This accepts free text and does not validate the bundle:
IMSI
Icons
Use icon to add an icon to the rendered plan tag. Use bundle-icon and imsi-icon to add icons to the bundle and IMSI labels.
Plan icon
Bundle icon
IMSI icon
Checkbox
Use type="checkbox" to render a checkbox input inside the plan tag, allowing users to select plans in a form.
Radio
Use type="radio" with a shared name attribute to create a radio group, allowing users to select a single plan.
Normalizing plan names
Use the standalone resolvePlan function to look up official plan names in server code, build tooling, or browser scripts. It uses the same lookup rules as ds-plan and works without a DOM or custom-element registration.
Server and build tooling
Import the resolver from the installed SDS package. This helper returns the full display name, including a matched bundle label, and preserves the original string when no match is found:
import { resolvePlan } from '@soracom/soracom-design-system/ds-plan/resolve';
export function getPlanName(value: string): string {
return resolvePlan(value)?.name ?? value;
}
getPlanName('k2'); // 'plan-K2'
getPlanName('Plan K2'); // 'plan-K2'
getPlanName('du10gb'); // 'plan-DU (10GB)'
getPlanName('unknown'); // 'unknown'
resolvePlan accepts a string, null, or undefined. It returns an object containing key, plan, name, background-color, and text-color, along with any aliases, bundles, or beta metadata. Unknown or empty inputs return null.
Use name for the full display text. The plan field contains the base plan label, and bundle contains the matched bundle label when present. Without a bundle, name equals plan:
const resolved = resolvePlan('DU-50GB');
resolved?.key; // 'du'
resolved?.plan; // 'plan-DU'
resolved?.bundle; // '50GB'
resolved?.name; // 'plan-DU (50GB)'
The ds-plan component uses plan and bundle separately to render its labels. The bundle attribute overrides the matched bundle label; bundle="" hides it.
Browser scripts
Import the standalone module from the CDN inside a module script:
<script type="module">
import { resolvePlan } from 'https://assets.soracom.io/sds/beta/ds-plan/resolve/index.mjs';
const value = 'k2';
const name = resolvePlan(value)?.name ?? value;
console.log(name); // 'plan-K2'
</script>
Use the same SDS version for the resolver and the component. The ds-plan component already includes the resolver; import it separately when you need to resolve strings in your own code.
Supported plans
The table lists each plan and its bundles on separate rows. Bundle aliases combine each plan key or alias with the bundle key. For example, the du plan and 10gb bundle produce du10gb. These mappings control display labels; they do not validate bundle availability or eligibility.
| Name | Aliases | Background color | Text color | Example |
|---|---|---|---|---|
| plan01s | 01s | --background-gray-600 | --color-light-light | |
| plan01s-LDV | 01sldv, 01slowdatavolume | --background-gray-600 | --color-light-light | |
| plan-D | d | --background-gray-200 | --color-dark-dark | |
| plan-D (500MB) | d500mb | --background-gray-200 | --color-dark-dark | |
| plan-D (300MB) | d300mb | --background-gray-200 | --color-dark-dark | |
| plan-D (No bundle) | dnobundle | --background-gray-200 | --color-dark-dark | |
| plan-D (Data/SMS) | ddatasms | --background-gray-200 | --color-dark-dark | |
| plan-D (Data-only) | ddataonly | --background-gray-200 | --color-dark-dark | |
| plan-DU | du | --background-gray-200 | --color-dark-dark | |
| plan-DU (10GB) | du10gb | --background-gray-200 | --color-dark-dark | |
| plan-DU (50GB) | du50gb | --background-gray-200 | --color-dark-dark | |
| plan-DU (100GB) | du100gb | --background-gray-200 | --color-dark-dark | |
| plan-K | k | --background-orange-300 | --color-dark-dark | |
| plan-K2 | k2 | --background-celeste-400 | --color-dark-dark | |
| plan-K2 (500MB) | k2500mb | --background-celeste-400 | --color-dark-dark | |
| plan-K2 (300MB) | k2300mb | --background-celeste-400 | --color-dark-dark | |
| plan-KM1 | km1 | --background-celeste-400 | --color-dark-dark | |
| planArc01 | arc01 | --background-magenta-400 | --color-light-light | |
| plan-MC | mc | --background-red-600 | --color-light-light | |
| plan-MC (500GB) | mc500gb | --background-red-600 | --color-light-light | |
| plan-MU | mu | --background-red-600 | --color-light-light | |
| plan-NA1 | na1 | --background-dark-dark | --color-light-light | |
| planNT1 | nt1 | --background-green-400 | --color-light-light | |
| planP1 | p1 | --background-purple-400 | --color-light-light | |
| plan-US | us | --background-blue-600 | --color-light-light | |
| plan-US-max | usmax | --background-blue-600 | --color-light-light | |
| plan-US-NA | usna | --background-blue-600 | --color-light-light | |
| planFX1 | fx1 | --background-yellow-400 | --color-dark-dark | |
| planX1 | x1 | --background-red-300 | --color-light-light | |
| planX2 | x2 | --background-blue-300 | --color-light-light | |
| planX3 | x3 | --background-orange-300 | --color-dark-dark | |
| planX3 (5MB) | x35mb | --background-orange-300 | --color-dark-dark | |
| planX3-EU | x3eu | --background-orange-300 | --color-dark-dark | |
| planX3-EU (25MB) | x3eu25mb | --background-orange-300 | --color-dark-dark | |
| planX3-EU (100MB) | x3eu100mb | --background-orange-300 | --color-dark-dark | |
| planX3-EU (500MB) | x3eu500mb | --background-orange-300 | --color-dark-dark | |
| planX3-EU (1GB) | x3eu1gb | --background-orange-300 | --color-dark-dark | |
| planX3-EU (3GB) | x3eu3gb | --background-orange-300 | --color-dark-dark | |
| planXM1 | xm1 | --background-red-300 | --color-light-light |
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
plan |
Plan name string | — | Sets the plan name via attribute instead of inner text. Unknown keys render with the fallback color and normalized label. |
bundle |
Bundle label string | — | Overrides the bundle label from a plan alias with free text. An empty value hides the label. |
imsi |
15 digit IMSI string | — | Displays an IMSI label alongside the bundle label. |
icon |
Icon name | — | Adds an icon to the rendered plan tag as a --icon-* modifier. |
bundle-icon |
Icon name | — | Adds an icon to the bundle label as a --icon-* modifier. |
imsi-icon |
Icon name | — | Adds an icon to the IMSI label as a --icon-* modifier. |
size |
xsmall, small, medium, large |
— | Controls the size of the plan tag. |
type |
checkbox, radio |
— | Renders an input element inside the tag for use in forms. |
name |
Input name string | — | Sets the name attribute on the internal input. Use a shared name across radio-type plans to create a radio group. |
css |
global |
global |
Sets the CSS loading mode. Global CSS is the default and does not need to be specified. |
Manifest
The component manifest describes this component's API: its modifiers, structure, data attributes, CSS custom properties, accessibility notes, and example markup. It is consumed by tooling such as AI assistants and code generators.
Latest version: https://assets.soracom.io/sds/3.45.0/ds-plan/manifest.json?v=3.45.0
plans.json
Supported SORACOM short plan keys, base plan labels, color classes, optional alternate-name aliases, and optional bundles mapping normalized bundle keys to label text.
Source: https://assets.soracom.io/sds/3.45.0/ds-plan/plans.json