@phun-ky/speccer / SpeccerOptionsInterface
Interface: SpeccerOptionsInterface
Defined in: types/speccer.ts:122
Configuration object that tells Speccer what to render and how to render it.
Feature flags
Only one top-level type is active at a time ("pin" | "grid" | "mark" | "typography" | "measure" | "spacing"). The corresponding nested section (e.g. pin, grid, typography, measure, spacing) becomes relevant and other sections are typically omitted.
Examples
import type { SpeccerOptionsInterface } from '@phun-ky/speccer';
const options: SpeccerOptionsInterface = {
slug: 'pinBracketSubtle',
position: 'left',
type: 'pin',
pin: {
bracket: true,
enclose: false,
subtle: true,
parent: false,
text: false,
useSVGLine: true,
useCurlyBrackets: false
}
};const options: SpeccerOptionsInterface = {
slug: 'measureWidthSlim',
position: 'bottom',
type: 'measure',
measure: {
slim: true,
height: false,
width: true
}
};const options: SpeccerOptionsInterface = {
slug: 'codeSample',
position: 'right',
type: 'typography',
typography: {
useSyntaxHighlighting: true
}
};const marginOnly: SpeccerOptionsInterface = {
slug: 'spacingMargin',
position: 'top',
type: 'spacing',
spacing: {
margin: true,
padding: false,
both: false,
bound: false
}
};
const bothWithBounds: SpeccerOptionsInterface = {
slug: 'spacingBothBound',
position: 'top',
type: 'spacing',
spacing: {
margin: false,
padding: false,
both: true,
bound: true
}
};const gridBoth: SpeccerOptionsInterface = {
slug: 'gridBoth',
position: 'bottom',
type: 'grid',
grid: {
toggle: 'both', // allowed: "rows" | "columns" | "both"
both: true,
rows: false,
columns: false
}
};
const gridRows: SpeccerOptionsInterface = {
slug: 'gridRows',
position: 'bottom',
type: 'grid',
grid: {
toggle: 'rows',
both: false,
rows: true,
columns: false
}
};Properties
grid?
optional grid: {
both?: boolean;
columns?: boolean;
rows?: boolean;
toggle: string;
};Defined in: types/speccer.ts:247
Options for the "grid" feature.
both?
optional both: boolean;Convenience flag set when both rows and columns are active.
columns?
optional columns: boolean;Convenience flag set when only columns are active.
rows?
optional rows: boolean;Convenience flag set when only rows are active.
toggle
toggle: string;Controls which grid axes are active.
Remarks
Allowed values: "rows" | "columns" | "both".
Remarks
Present only when type is "grid". toggle indicates the primary axis selection and should be "rows" | "columns" | "both". The convenience flags (both, rows, columns) mirror the current state for easy checks.
measure?
optional measure: {
height: boolean;
slim: boolean;
width: boolean;
};Defined in: types/speccer.ts:188
Options for the "measure" feature.
height
height: boolean;Show a vertical measurement (element height).
slim
slim: boolean;Use a compact (thinner) measurement style.
width
width: boolean;Show a horizontal measurement (element width).
Remarks
Present only when type is "measure". Use height and/or width to select the axis to measure; slim switches to a compact rendering style for tight layouts.
pin?
optional pin: {
bracket: boolean;
enclose: boolean;
parent: boolean;
subtle: boolean;
text: boolean;
useCurlyBrackets: boolean;
useSVGLine: boolean;
};Defined in: types/speccer.ts:157
Options for the "pin" feature.
bracket
bracket: boolean;Draw bracket-style markers around the pin.
enclose
enclose: boolean;Enclose the pin target (e.g., a boxed/outlined emphasis).
parent
parent: boolean;Indicate that the pin references a parent container/element.
subtle
subtle: boolean;Reduce visual weight for a subtler presentation.
text
text: boolean;Render an inline text label along with the pin.
useCurlyBrackets
useCurlyBrackets: boolean;Use curly brackets for bracketed pins instead of straight brackets.
useSVGLine
useSVGLine: boolean;Use an SVG line primitive instead of a DOM line.
Remarks
Present only when type is "pin". Each flag toggles a specific pin decoration or behavior.
position
position: SpeccerPositionType;Defined in: types/speccer.ts:139
Preferred anchor side for rendering or label placement.
Remarks
Use to hint where visual affordances (e.g., labels, callouts) should appear relative to the annotated element.
slug
slug: string;Defined in: types/speccer.ts:130
Machine-readable identifier for this option set.
Remarks
When produced by getOptions, this is derived from the input areaString using a camel-casing strategy (e.g., "pin bracket subtle" → "pinBracketSubtle").
spacing?
optional spacing: {
both?: boolean;
bound?: boolean;
margin?: boolean;
padding?: boolean;
};Defined in: types/speccer.ts:219
Options for the "spacing" feature.
both?
optional both: boolean;Visualize both margin and padding in a combined overlay.
Remarks
Mutually exclusive with margin and padding where applicable.
bound?
optional bound: boolean;Emphasize the bounding outline of the target in addition to spacing.
Remarks
Often used to show the element's overall occupied box.
margin?
optional margin: boolean;Visualize the element's margins.
padding?
optional padding: boolean;Visualize the element's padding.
Remarks
Present only when type is "spacing". Exactly one of margin, padding, or both is typically true. bound can be used to visualize the outer bound in addition to spacing.
type
type: SpeccerFeatureType;Defined in: types/speccer.ts:148
Which Speccer feature this option set activates.
Remarks
This field determines which nested section is relevant (pin, grid, mark, typography, measure, or spacing). Only one feature is active at a time.
typography?
optional typography: {
useSyntaxHighlighting: boolean;
};Defined in: types/speccer.ts:206
Options for the "typography" feature.
useSyntaxHighlighting
useSyntaxHighlighting: boolean;Enable syntax highlighting for textual samples.
Remarks
Present only when type is "typography". Enables code-like styling or syntax coloring when appropriate.