superset-frontend/packages/superset-core/README.md
The official core package for building Apache Superset extensions and integrations. This package provides essential building blocks including shared UI components, utility functions, APIs, and type definitions for both the host application and extensions.
npm install @apache-superset/core
The source is organized into focused namespaces, each in its own directory:
src/
āāā authentication/
āāā commands/
āāā common/
āāā components/
āāā contributions/
āāā editors/
āāā extensions/
āāā menus/
āāā sqlLab/
āāā theme/
āāā translation/
āāā utils/
āāā views/
āāā index.ts
Frontend contributions are registered as module-level side effects from your extension's entry point.
Add custom panels or UI components at specific locations in the application:
import { views } from '@apache-superset/core';
import MyPanel from './MyPanel';
views.registerView(
{ id: 'my-extension.main', name: 'My Panel Name' },
'sqllab.panels',
() => <MyPanel />,
);
Define named actions that can be triggered from menus, keyboard shortcuts, or code:
import { commands } from '@apache-superset/core';
commands.registerCommand(
{
id: 'my-extension.copy-query',
title: 'Copy Query',
icon: 'CopyOutlined',
description: 'Copy the current query to clipboard',
},
() => {
/* implementation */
},
);
Attach commands to primary, secondary, or context menus at a given location:
import { menus } from '@apache-superset/core';
menus.registerMenuItem(
{ view: 'sqllab.editor', command: 'my-extension.copy-query' },
'sqllab.editor',
'primary',
);
Replace the default text editor for one or more languages:
import { editors } from '@apache-superset/core';
import MonacoSQLEditor from './MonacoSQLEditor';
editors.registerEditor(
{
id: 'my-extension.monaco-sql',
name: 'Monaco SQL Editor',
languages: ['sql'],
},
MonacoSQLEditor,
);
Licensed under the Apache License, Version 2.0. See LICENSE for details.