Choose a reference region
Sample 042 / Region of interest
Collects a reference, contig and validated integer interval with an explicit one-based inclusive coordinate convention and native form submission.
Sample 042 / Region of interest
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { GenomicRegionField } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/genomic-region-field.
npx @noorddev/vlak-cli add genomic-region-field
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/genomic-region-field.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { GenomicRegionField } from "@noorddev/vlak-react";
<GenomicRegionField label="Region" reference="Example reference" name="region" contigs={[{ id: "chr7", length: 100000 }, { id: "chr8", length: 80000 }]} defaultValue={{ contig: "chr7", start: 101, end: 105 }} required />A region in one-based inclusive coordinates. No assembly or half-open conversion is performed.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | ReactNode | ||
referencerequired | string | Fixed reference name or accession, submitted with the region. | |
contigsrequired | readonly GenomicContig[] | ||
value | GenomicRegion | ||
defaultValue | GenomicRegion | emptyRegion | |
onValueChange | (value: GenomicRegion) => void | ||
required | boolean | false | |
readOnly | boolean | false | |
description | ReactNode |
Also accepts Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "defaultValue">.
| Keys | Does |
|---|---|
| Tab | Moves through the contig, start and end controls. |
| Arrow keys, typing | Opens and navigates the Vlak contig selector or edits numeric inputs. Enter or Space confirms a contig; Escape closes its menu. |
<fieldset class="rs-genomic-region-field"><legend class="rs-genomic-region-field-legend">Region</legend><p class="rs-genomic-region-field-copy">Reference: Example reference</p><p class="rs-genomic-region-field-copy">1-based, inclusive. Both start and end are included.</p><div class="rs-genomic-region-field-fields"><div class="rs-genomic-region-field-label"><span id="genomic-contig-label">Contig</span><div class="rs-select rs-select-fluid"><button type="button" class="rs-dropdown" role="combobox" aria-labelledby="genomic-contig-label" aria-expanded="false" aria-haspopup="listbox"><span>chr7</span></button></div></div><label class="rs-genomic-region-field-label">Start<input class="rs-input rs-input-full rs-genomic-region-field-control" type="number" min="1" step="1" name="region.start" value="101" /></label><label class="rs-genomic-region-field-label">End<input class="rs-input rs-input-full rs-genomic-region-field-control" type="number" min="1" step="1" name="region.end" value="105" /></label></div></fieldset>