Soracom

Design System

Plan

DS Plan component for showing Soracom SIM plans

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:

  • The official plan name. i.e. plan-K2
  • The short alias plan name. i.e. k2

<ds-plan>[plan name]</ds-plan>

html
Copy

<ds-plan plan="[plan name]"></ds-plan>

html
Copy

Inline usage

The ds-plan component can be used inline within text, automatically matching the surrounding font size.

html
Copy

Sizing

html
Copy

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:

html
Copy

Alternatively, you can use the bundle attribute to specify a custom bundle label. This accepts free text and does not validate the bundle:

html
Copy

IMSI

html
Copy

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

html
Copy

Bundle icon

html
Copy

IMSI icon

html
Copy

Checkbox

Use type="checkbox" to render a checkbox input inside the plan tag, allowing users to select plans in a form.

html
Copy

Radio

Use type="radio" with a shared name attribute to create a radio group, allowing users to select a single plan.

html
Copy

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.

NameAliasesBackground colorText colorExample
plan01s01s--background-gray-600--color-light-lightplan01s
plan01s-LDV01sldv, 01slowdatavolume--background-gray-600--color-light-lightplan01s-LDV
plan-Dd--background-gray-200--color-dark-darkplan-D
plan-D (500MB)d500mb--background-gray-200--color-dark-darkplan-D (500MB)
plan-D (300MB)d300mb--background-gray-200--color-dark-darkplan-D (300MB)
plan-D (No bundle)dnobundle--background-gray-200--color-dark-darkplan-D (No bundle)
plan-D (Data/SMS)ddatasms--background-gray-200--color-dark-darkplan-D (Data/SMS)
plan-D (Data-only)ddataonly--background-gray-200--color-dark-darkplan-D (Data-only)
plan-DUdu--background-gray-200--color-dark-darkplan-DU
plan-DU (10GB)du10gb--background-gray-200--color-dark-darkplan-DU (10GB)
plan-DU (50GB)du50gb--background-gray-200--color-dark-darkplan-DU (50GB)
plan-DU (100GB)du100gb--background-gray-200--color-dark-darkplan-DU (100GB)
plan-Kk--background-orange-300--color-dark-darkplan-K
plan-K2k2--background-celeste-400--color-dark-darkplan-K2
plan-K2 (500MB)k2500mb--background-celeste-400--color-dark-darkplan-K2 (500MB)
plan-K2 (300MB)k2300mb--background-celeste-400--color-dark-darkplan-K2 (300MB)
plan-KM1km1--background-celeste-400--color-dark-darkplan-KM1
planArc01arc01--background-magenta-400--color-light-lightplanArc01
plan-MCmc--background-red-600--color-light-lightplan-MC
plan-MC (500GB)mc500gb--background-red-600--color-light-lightplan-MC (500GB)
plan-MUmu--background-red-600--color-light-lightplan-MU
plan-NA1na1--background-dark-dark--color-light-lightplan-NA1
planNT1nt1--background-green-400--color-light-lightplanNT1
planP1p1--background-purple-400--color-light-lightplanP1
plan-USus--background-blue-600--color-light-lightplan-US
plan-US-maxusmax--background-blue-600--color-light-lightplan-US-max
plan-US-NAusna--background-blue-600--color-light-lightplan-US-NA
planFX1fx1--background-yellow-400--color-dark-darkplanFX1
planX1x1--background-red-300--color-light-lightplanX1
planX2x2--background-blue-300--color-light-lightplanX2
planX3x3--background-orange-300--color-dark-darkplanX3
planX3 (5MB)x35mb--background-orange-300--color-dark-darkplanX3 (5MB)
planX3-EUx3eu--background-orange-300--color-dark-darkplanX3-EU
planX3-EU (25MB)x3eu25mb--background-orange-300--color-dark-darkplanX3-EU (25MB)
planX3-EU (100MB)x3eu100mb--background-orange-300--color-dark-darkplanX3-EU (100MB)
planX3-EU (500MB)x3eu500mb--background-orange-300--color-dark-darkplanX3-EU (500MB)
planX3-EU (1GB)x3eu1gb--background-orange-300--color-dark-darkplanX3-EU (1GB)
planX3-EU (3GB)x3eu3gb--background-orange-300--color-dark-darkplanX3-EU (3GB)
planXM1xm1--background-red-300--color-light-lightplanXM1

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

manifest.json
Copy

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

plans.json
Copy