mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(docs): Docusaurus multi-versioning, Developer Portal starter kit (#34271)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
105
docs/components/chart-components/bar-chart.md
Normal file
105
docs/components/chart-components/bar-chart.md
Normal file
@@ -0,0 +1,105 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
---
|
||||
title: Bar Chart
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Bar Chart Component
|
||||
|
||||
The Bar Chart component is used to visualize categorical data with rectangular bars.
|
||||
|
||||
## Props
|
||||
|
||||
| Prop | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `data` | `array` | `[]` | Array of data objects to visualize |
|
||||
| `width` | `number` | `800` | Width of the chart in pixels |
|
||||
| `height` | `number` | `600` | Height of the chart in pixels |
|
||||
| `xField` | `string` | - | Field name for x-axis values |
|
||||
| `yField` | `string` | - | Field name for y-axis values |
|
||||
| `colorField` | `string` | - | Field name for color encoding |
|
||||
| `colorScheme` | `string` | `'supersetColors'` | Color scheme to use |
|
||||
| `showLegend` | `boolean` | `true` | Whether to show the legend |
|
||||
| `showGrid` | `boolean` | `true` | Whether to show grid lines |
|
||||
| `labelPosition` | `string` | `'top'` | Position of bar labels: 'top', 'middle', 'bottom' |
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Bar Chart
|
||||
|
||||
```jsx
|
||||
import { BarChart } from '@superset-ui/chart-components';
|
||||
|
||||
const data = [
|
||||
{ category: 'A', value: 10 },
|
||||
{ category: 'B', value: 20 },
|
||||
{ category: 'C', value: 15 },
|
||||
{ category: 'D', value: 25 },
|
||||
];
|
||||
|
||||
function Example() {
|
||||
return (
|
||||
<BarChart
|
||||
data={data}
|
||||
width={800}
|
||||
height={400}
|
||||
xField="category"
|
||||
yField="value"
|
||||
colorScheme="supersetColors"
|
||||
/>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Grouped Bar Chart
|
||||
|
||||
```jsx
|
||||
import { BarChart } from '@superset-ui/chart-components';
|
||||
|
||||
const data = [
|
||||
{ category: 'A', group: 'Group 1', value: 10 },
|
||||
{ category: 'A', group: 'Group 2', value: 15 },
|
||||
{ category: 'B', group: 'Group 1', value: 20 },
|
||||
{ category: 'B', group: 'Group 2', value: 25 },
|
||||
{ category: 'C', group: 'Group 1', value: 15 },
|
||||
{ category: 'C', group: 'Group 2', value: 10 },
|
||||
];
|
||||
|
||||
function Example() {
|
||||
return (
|
||||
<BarChart
|
||||
data={data}
|
||||
width={800}
|
||||
height={400}
|
||||
xField="category"
|
||||
yField="value"
|
||||
colorField="group"
|
||||
colorScheme="supersetColors"
|
||||
/>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use bar charts when comparing quantities across categories
|
||||
- Sort bars by value for better readability, unless there's a natural order to the categories
|
||||
- Use consistent colors for the same categories across different charts
|
||||
- Consider using horizontal bar charts when category labels are long
|
||||
59
docs/components/index.md
Normal file
59
docs/components/index.md
Normal file
@@ -0,0 +1,59 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
---
|
||||
title: Component Library
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Superset Component Library
|
||||
|
||||
Welcome to the Apache Superset Component Library documentation. This section provides comprehensive documentation for all the UI components, chart components, and layout components used in Superset.
|
||||
|
||||
## What is the Component Library?
|
||||
|
||||
The Component Library is a collection of reusable UI components that are used to build the Superset user interface. These components are designed to be consistent, accessible, and easy to use.
|
||||
|
||||
## Component Categories
|
||||
|
||||
The Component Library is organized into the following categories:
|
||||
|
||||
### UI Components
|
||||
|
||||
Basic UI components like buttons, inputs, dropdowns, and other form elements.
|
||||
|
||||
### Chart Components
|
||||
|
||||
Visualization components used to render different types of charts and graphs.
|
||||
|
||||
### Layout Components
|
||||
|
||||
Components used for page layout, such as containers, grids, and navigation elements.
|
||||
|
||||
## Versioning
|
||||
|
||||
The Component Library documentation follows its own versioning scheme, independent from the main Superset documentation. This allows us to update the component documentation as the components evolve, without affecting the main documentation.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Browse the sidebar to explore the different components available in the library. Each component documentation includes:
|
||||
|
||||
- Component description and purpose
|
||||
- Props and configuration options
|
||||
- Usage examples
|
||||
- Best practices
|
||||
113
docs/components/layout-components/grid.md
Normal file
113
docs/components/layout-components/grid.md
Normal file
@@ -0,0 +1,113 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
---
|
||||
title: Grid
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Grid Component
|
||||
|
||||
The Grid component provides a flexible layout system for arranging content in rows and columns.
|
||||
|
||||
## Props
|
||||
|
||||
| Prop | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `gutter` | `number` or `[number, number]` | `0` | Grid spacing between items, can be a single number or [horizontal, vertical] |
|
||||
| `columns` | `number` | `12` | Number of columns in the grid |
|
||||
| `justify` | `string` | `'start'` | Horizontal alignment: 'start', 'center', 'end', 'space-between', 'space-around' |
|
||||
| `align` | `string` | `'top'` | Vertical alignment: 'top', 'middle', 'bottom' |
|
||||
| `wrap` | `boolean` | `true` | Whether to wrap items when they overflow |
|
||||
|
||||
### Row Props
|
||||
|
||||
| Prop | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `gutter` | `number` or `[number, number]` | `0` | Spacing between items in the row |
|
||||
| `justify` | `string` | `'start'` | Horizontal alignment for this row |
|
||||
| `align` | `string` | `'top'` | Vertical alignment for this row |
|
||||
|
||||
### Col Props
|
||||
|
||||
| Prop | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `span` | `number` | - | Number of columns the grid item spans |
|
||||
| `offset` | `number` | `0` | Number of columns the grid item is offset |
|
||||
| `xs`, `sm`, `md`, `lg`, `xl` | `number` or `object` | - | Responsive props for different screen sizes |
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Grid
|
||||
|
||||
```jsx
|
||||
import { Grid, Row, Col } from '@superset-ui/core';
|
||||
|
||||
function Example() {
|
||||
return (
|
||||
<Grid>
|
||||
<Row gutter={16}>
|
||||
<Col span={8}>
|
||||
<div>Column 1</div>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<div>Column 2</div>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<div>Column 3</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Responsive Grid
|
||||
|
||||
```jsx
|
||||
import { Grid, Row, Col } from '@superset-ui/core';
|
||||
|
||||
function Example() {
|
||||
return (
|
||||
<Grid>
|
||||
<Row gutter={[16, 24]}>
|
||||
<Col xs={24} sm={12} md={8} lg={6}>
|
||||
<div>Responsive Column 1</div>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} md={8} lg={6}>
|
||||
<div>Responsive Column 2</div>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} md={8} lg={6}>
|
||||
<div>Responsive Column 3</div>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} md={8} lg={6}>
|
||||
<div>Responsive Column 4</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use the Grid system for complex layouts that need to be responsive
|
||||
- Specify column widths for different screen sizes to ensure proper responsive behavior
|
||||
- Use gutters to create appropriate spacing between grid items
|
||||
- Keep the grid structure consistent throughout your application
|
||||
- Consider using the grid system for dashboard layouts to ensure consistent spacing and alignment
|
||||
35
docs/components/test.mdx
Normal file
35
docs/components/test.mdx
Normal file
@@ -0,0 +1,35 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
---
|
||||
title: Test
|
||||
---
|
||||
|
||||
import { StoryExample } from '../src/components/StorybookWrapper';
|
||||
|
||||
# Test
|
||||
|
||||
This is a test using our custom StorybookWrapper component.
|
||||
|
||||
<StoryExample
|
||||
component={() => (
|
||||
<div style={{ padding: '10px', background: '#f0f0f0', borderRadius: '4px' }}>
|
||||
This is a simple example component
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
146
docs/components/ui-components/button.mdx
Normal file
146
docs/components/ui-components/button.mdx
Normal file
@@ -0,0 +1,146 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
---
|
||||
title: Button Component
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import { StoryExample, StoryWithControls } from '../../src/components/StorybookWrapper';
|
||||
import { Button } from '../../../superset-frontend/packages/superset-ui-core/src/components/Button';
|
||||
|
||||
# Button Component
|
||||
|
||||
The Button component is a fundamental UI element used throughout Superset for user interactions.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
The default button with primary styling:
|
||||
<StoryExample
|
||||
component={() => (
|
||||
<Button buttonStyle="primary" onClick={() => console.log('Clicked!')}>
|
||||
Click Me
|
||||
</Button>
|
||||
)}
|
||||
/>
|
||||
|
||||
## Interactive Example
|
||||
|
||||
<StoryWithControls
|
||||
component={({ buttonStyle, buttonSize, label, disabled }) => (
|
||||
<Button
|
||||
buttonStyle={buttonStyle}
|
||||
buttonSize={buttonSize}
|
||||
disabled={disabled}
|
||||
onClick={() => console.log('Clicked!')}
|
||||
>
|
||||
{label}
|
||||
</Button>
|
||||
)}
|
||||
props={{
|
||||
buttonStyle: 'primary',
|
||||
buttonSize: 'default',
|
||||
label: 'Click Me',
|
||||
disabled: false
|
||||
}}
|
||||
controls={[
|
||||
{
|
||||
name: 'buttonStyle',
|
||||
label: 'Button Style',
|
||||
type: 'select',
|
||||
options: ['primary', 'secondary', 'tertiary', 'success', 'warning', 'danger', 'default', 'link', 'dashed']
|
||||
},
|
||||
{
|
||||
name: 'buttonSize',
|
||||
label: 'Button Size',
|
||||
type: 'select',
|
||||
options: ['default', 'small', 'xsmall']
|
||||
},
|
||||
{
|
||||
name: 'label',
|
||||
label: 'Button Text',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'disabled',
|
||||
label: 'Disabled',
|
||||
type: 'boolean'
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
## Props
|
||||
|
||||
| Prop | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `buttonStyle` | `'primary' \| 'secondary' \| 'tertiary' \| 'success' \| 'warning' \| 'danger' \| 'default' \| 'link' \| 'dashed'` | `'default'` | Button style |
|
||||
| `buttonSize` | `'default' \| 'small' \| 'xsmall'` | `'default'` | Button size |
|
||||
| `disabled` | `boolean` | `false` | Whether the button is disabled |
|
||||
| `cta` | `boolean` | `false` | Whether the button is a call-to-action button |
|
||||
| `tooltip` | `ReactNode` | - | Tooltip content |
|
||||
| `placement` | `TooltipProps['placement']` | - | Tooltip placement |
|
||||
| `onClick` | `function` | - | Callback when button is clicked |
|
||||
| `href` | `string` | - | Turns button into an anchor link |
|
||||
| `target` | `string` | - | Target attribute for anchor links |
|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
import Button from 'src/components/Button';
|
||||
|
||||
function MyComponent() {
|
||||
return (
|
||||
<Button
|
||||
buttonStyle="primary"
|
||||
onClick={() => console.log('Button clicked')}
|
||||
>
|
||||
Click Me
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Button Styles
|
||||
|
||||
Superset provides a variety of button styles for different purposes:
|
||||
|
||||
- **Primary**: Used for primary actions
|
||||
- **Secondary**: Used for secondary actions
|
||||
- **Tertiary**: Used for less important actions
|
||||
- **Success**: Used for successful or confirming actions
|
||||
- **Warning**: Used for actions that require caution
|
||||
- **Danger**: Used for destructive actions
|
||||
- **Link**: Used for navigation
|
||||
- **Dashed**: Used for adding new items or features
|
||||
|
||||
## Button Sizes
|
||||
|
||||
Buttons come in three sizes:
|
||||
|
||||
- **Default**: Standard size for most use cases
|
||||
- **Small**: Compact size for tight spaces
|
||||
- **XSmall**: Extra small size for very limited spaces
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use primary buttons for the main action in a form or page
|
||||
- Use secondary buttons for alternative actions
|
||||
- Use danger buttons for destructive actions
|
||||
- Limit the number of primary buttons on a page to avoid confusion
|
||||
- Use consistent button styles throughout your application
|
||||
- Add tooltips to buttons when their purpose might not be immediately clear
|
||||
1
docs/components/versions.json
Normal file
1
docs/components/versions.json
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
||||
Reference in New Issue
Block a user