TX Sheet Control

DashboardWidgetAppearance Interface

Interface

Portable widget presentation, shared by browser authoring and headless rendering. Sizes are points (8..72); colors are six-digit hex. Omitted fields inherit the dashboard defaults.

Package: @txtextcontrol/tx-sheet-control-server. This is a settings/result contract, not a runtime constructor.

Members

PropertyDescription
backgroundColorConfigures backgroundColor on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
gradientPortable color stops; backgrounds render identically in browser and headless SVG.
paddingCard geometry in CSS pixels; padding 0..48, radius 0..32, border 0..8.
borderRadiusConfigures borderRadius on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
borderWidthConfigures borderWidth on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
shadowSoft card shadow. Opacity 0..1, blur 0..40, offset -20..20 CSS pixels.
borderColorConfigures borderColor on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
titleColorConfigures titleColor on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
titleFontSizeConfigures titleFontSize on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
showTitleConfigures showTitle on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
textColorConfigures textColor on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
fontFamilyConfigures fontFamily on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
fontSizeConfigures fontSize on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
boldConfigures bold on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
italicConfigures italic on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
underlineConfigures underline on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
horizontalAlignConfigures horizontalAlign on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
chartColorsOrdered palette, 1..12 colors. Bar/line series and pie/donut categories cycle through it.
legendConfigures legend on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
showDataLabelsConfigures showDataLabels on DashboardWidgetAppearance; apply the complete settings object through its owning dashboard.
animationQuick chart entrance animation; defaults to true. Browser reduced-motion preferences always take precedence.

Examples

Configure a complete sales dashboard using this contract. Pass the workbook from your existing editor or server control.

import type { Workbook, DashboardWidgetAppearance } from '@txtextcontrol/tx-sheet-control-server';

async function configureSalesDashboard(book: Workbook) {
    const sheet = book.sheets.at(0);
    sheet.range('A1:G5').setValues([
        ['Region', 'Country', 'Customer', 'Revenue', 'Profit', 'Date', 'Units'],
        ['Europe', 'Germany', 'Studio', 42000, 12000, '2026-01-15', 12],
        ['Europe', 'France', 'Labs', 38000, 9000, '2026-02-15', 15],
        ['Americas', 'Canada', 'Partners', 31000, 8000, '2026-01-15', 9],
        ['Americas', 'United States', 'Design', 49000, 15000, '2026-02-15', 18]
    ]);
    book.analytics.setSource({ id: 'sales', name: 'Sales', sheetId: sheet.id, range: 'A1:G5', hasHeaderRow: true });
    const dashboard = book.dashboards.add('Sales Performance');
    dashboard.update({ sections: [{ id: 'summary', title: 'Executive Summary' }] });
    dashboard.addWidget({
        id: 'revenue', type: 'column', title: 'Regional Revenue',
        placement: { x: 0, y: 0, width: 8, height: 6 },
        query: { sourceId: 'sales', dimensions: ['Region'], measures: [
            { field: 'Revenue', aggregation: 'SUM', alias: 'Revenue' },
            { field: 'Profit', aggregation: 'SUM', alias: 'Profit' }
        ] }
    });
    const settings: DashboardWidgetAppearance = {
        "gradient": {
            "type": "linear",
            "angle": 135,
            "stops": [
                {
                    "offset": 0,
                    "color": "#12335A"
                },
                {
                    "offset": 1,
                    "color": "#376E9C"
                }
            ]
        },
        "padding": 20,
        "borderRadius": 16,
        "borderWidth": 1,
        "shadow": {
            "color": "#000000",
            "opacity": 0.12,
            "blur": 16,
            "offsetX": 0,
            "offsetY": 4
        },
        "fontFamily": "Noto Sans",
        "fontSize": 11,
        "textColor": "#F2F6FF",
        "backgroundColor": "#17385A",
        "titleColor": "#FFFFFF",
        "borderColor": "#496586",
        "titleFontSize": 13,
        "showTitle": true,
        "bold": false,
        "italic": false,
        "underline": false,
        "horizontalAlign": "left",
        "chartColors": [
            "#75B5FF",
            "#5CD4B4"
        ],
        "legend": "bottom",
        "showDataLabels": true,
        "animation": true
    };
    dashboard.updateWidget('revenue', { appearance: settings });
    const { writeFile: saveDashboard } = await import('node:fs/promises');
    await saveDashboard('sales-dashboard.svg', await dashboard.renderSvg());
}