Nucleotide
DNA and RNA bases as colored tiles, and whole strands as blocks of them: a numbered ruler, the complementary strand, codons with what they make, highlights and selection. Every color scheme is drawn in one tone system, so the classic schemes sit next to Nelumbo's palette at one even lightness.
Install
npx shadcn@latest add @nelumbo/nucleotideBases
A tile per base, named on hover. Ambiguity codes are neutral, a gap has no tile.
Variants and sizes
Tonal is the default. Solid is the full-strength tile that selection uses, subtle fades context, text drops the tile for long runs.
Shape
Sequences are connected by default, like a connected button group: corners tighten where bases meet and stay round at the ends of each block, and a selection becomes its own capsule. separate keeps every corner round.
Color schemes
Base pairs and purines and pyrimidines are Nelumbo's own. The others take their tools' hues, drawn at Nelumbo's lightness; the color-blind-safe set keeps its lightness steps.
Nelumbo
A green, C blue, G amber, T red, on the palette's hues
Base pairs
A and T share green, G and C share blue: complements match by eye
Purines and pyrimidines
Warm purines, cool pyrimidines
IGV
The Integrative Genomics Viewer's hues
Jalview
Jalview's nucleotide hues
Sanger trace
Chromatogram colors, G in gray
Color-blind safe
Okabe and Ito's set, apart in lightness as well as hue
None
Neutral tiles
Double strand
complement draws the paired base under each one, faded. With the base pairs scheme, every pair shares a hue.
Codons
A block of three with a footer: each codon over the amino acid it makes.
Mutations
NucleotideChange shows the reference, an arrow and the changed sequence. The bases that differ are found and drawn as a solid capsule in both; deletions and insertions are padded with gaps so the two line up.
Substitution
HBB c.20A>T, sickle cell
Deletion
CFTR c.1521_1523del, F508del
Insertion
One base, a frameshift
Sizes
sm and lg
Compact mutations
compact keeps only the bases that changed, as small connected tiles like AminoAcidChange: A to T, CTT to a gap. position joins a neutral segment in front, so it reads like c.20A>T. Pass the full context or just the bases; the change is found the same way.
The sickle cell allele, 20AT, swaps one base in the sixth codon of HBB.
Highlight
highlight brings stretches forward and fades the rest. Here, the EcoRI and BamHI sites in a cloning site.
Selection
selectable makes the strand one keyboard stop, like a chart. Drag or Shift-click to select; arrows move, Shift extends, Escape clears. The readout follows the pointer.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
Nucleotide base | string | A, C, G, T, U, an IUPAC ambiguity code, or - for a gap. | |
scheme | NucleotideScheme | "nelumbo" | nelumbo, pairs, chemistry, igv, jalview, trace, okabe-ito, none. |
variant | "tonal" | "solid" | "subtle" | "text" | "tonal" | Selected tiles are always solid. |
size | "sm" | "default" | "lg" | "default" | 20, 28 or 48 px tall. |
NucleotideSequence sequence | string | Whitespace and digits are ignored, so FASTA and GenBank paste as is. | |
groupSize | number | 10 | A spacer every n bases. 0 for none. |
ruler | boolean | "top" | "inline" | false | true or top: first position above each block. inline: last position in the spacer. |
start | number | 1 | Position of the first base. |
shape | "connected" | "separate" | "connected" | Connected joins each block into one shape; a selection becomes its own capsule. |
complement | boolean | false | Shows the paired strand under each base. |
highlight | { start, end }[] | Stretches to bring forward. 1-based, inclusive. | |
footer | (block) => ReactNode | Drawn under each block: codon translations, annotations. | |
selectable | boolean | false | Pointer and keyboard selection. |
selection / onSelectionChange | { start, end } | null | Controlled selection. defaultSelection for uncontrolled. | |
onActiveChange | (position | null) => void | The base under the pointer, or the keyboard cursor. | |
NucleotideChange from, to | string, string | Reference and changed sequence, with context. scheme and size as above. | |
NucleotideChange compact | boolean | false | Only the changed bases, as small connected tiles. |
NucleotideChange position | number | string | Compact only: a neutral segment joined in front of the original bases. | |
Helpers | alignChange, complement, reverseComplement, gcContent, translate, translateCodon, cleanSequence | Standard genetic code; RNA pairs A with U. |