Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Start Toolpad Core docs #3383

Merged
merged 26 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1d39942
docs: Start `core `docs
bharatkashyap Apr 11, 2024
dd6fb69
Merge branch 'master' into docs/toolpad-core-intro
bharatkashyap Apr 11, 2024
617aea5
Merge branch 'master' of github.com:mui/mui-toolpad into docs/toolpad…
bharatkashyap May 14, 2024
8906e2f
fix: Starter docs
bharatkashyap May 14, 2024
37d718c
fix: Copy
bharatkashyap May 14, 2024
b6157e0
Merge branch 'master' into docs/toolpad-core-intro
bharatkashyap May 16, 2024
8bf7950
Merge branch 'master' into docs/toolpad-core-intro
bharatkashyap May 20, 2024
62c40cc
Merge branch 'master' into docs/toolpad-core-intro
bharatkashyap May 27, 2024
88bd1bc
fix: Jan review 1
bharatkashyap May 27, 2024
f24bde7
Merge branch 'docs/toolpad-core-intro' of github.com:bharatkashyap/mu…
bharatkashyap May 27, 2024
82ffbd5
Merge branch 'master' of github.com:mui/mui-toolpad into docs/toolpad…
bharatkashyap May 29, 2024
4f34158
fix: Reference section minor fixes
bharatkashyap May 29, 2024
c8a1213
fix: Overview section
bharatkashyap May 29, 2024
c090ae6
fix: Installation and Tutorial
bharatkashyap May 29, 2024
1e00685
feat: Add Toolpad Core tutorial as example
bharatkashyap May 29, 2024
66472e9
fix: Add Support, Examples
bharatkashyap May 29, 2024
42047b4
fix: Misc minor corrections
bharatkashyap May 29, 2024
251569a
Merge branch 'master' into docs/toolpad-core-intro
bharatkashyap May 29, 2024
d0ac167
fix: Vale
bharatkashyap May 29, 2024
e06cb74
Merge branch 'docs/toolpad-core-intro' of github.com:bharatkashyap/mu…
bharatkashyap May 29, 2024
444f178
fix: Remove example to fix CI OOM
bharatkashyap May 29, 2024
63a107c
fix: CI
bharatkashyap May 30, 2024
d178c25
fix: Prettier
bharatkashyap May 30, 2024
c9ec1c9
Merge branch 'master' into docs/toolpad-core-intro
bharatkashyap May 30, 2024
f960769
fix: API build
bharatkashyap May 30, 2024
b48a8c5
fix: Use demo instead of image, Jan review 2
bharatkashyap May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data/toolpad/core/all-components/all-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- [App Provider](/toolpad/core/react-app-provider/)
- [Dashboard Layout](/toolpad/core/react-dashboard-layout/)
- [Data Grid](/toolpad/core/react-data-grid/)
3 changes: 0 additions & 3 deletions docs/data/toolpad/core/api/components/dashboard-layout.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/data/toolpad/core/api/index.md

This file was deleted.

18 changes: 9 additions & 9 deletions docs/data/toolpad/core/components/data-grid/data-grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ components: DataGrid, DataProvider

# Data Grid

<p class="description">Data Grid component for CRUD applications.</p>
<p class="description">Data Grid component for CRUD ("Create Read Update Delete") applications.</p>

Toolpad Core extends the X grid with CRUD functionality. It abstracts the manipulations in a data provider object. The data provider object describes the shape of the data and the available manipulations. When you pass the data provider to a grid it is automatically configured as a CRUD grid. All properties of the X grid are also available and can be used to override the data provider behavior.
Toolpad Core extends the [X data grid](https://mui.com/x/react-data-grid/) with CRUD functionality. It abstracts the manipulations in a data provider object. The data provider object describes the shape of the data and the available manipulations. When you pass the data provider to a grid it is automatically configured as a CRUD grid. All properties of the X grid are also available and can be used to override the data provider behavior.

Where Core and X components focus on the user interface, Toolpad Core components start from a definition of the data. It centralizes data loading, filtering, pagination, field formatting, mutations, access control and more.

Expand All @@ -20,13 +20,13 @@ The simplest data provider exposes a `getMany` function and a `fields` definitio

## Override columns

The Toolpad Core grid adopts the fields that are defined in its data provider. This is handy because it allows for sharing formatting and validation options between data rendering components. But it is still possible to override the defaults at the level of an individual grid. The grid adopts the columns you've defined in the `columns` property, and sets default values for the individual column options for each of them.
The Toolpad Core grid adopts the fields that are defined in its data provider. This is handy because it allows for sharing formatting and validation options between data rendering components. However, it is still possible to override the defaults at the level of an individual grid. The grid adopts the columns you've defined in the `columns` property, and sets default values for the individual column options for each of them.

{{"demo": "OverrideColumns.js"}}

## Column inferrence
## Column inference

To help you get started quickly, the grid is able to inferrence data provider fields if they are not defined. This allows you to quickly get started with a basic field definition based on the returned data. When a data provider is passed that doesn't have a field definiton, the grid infers field definitions and shows a warning. Click the question mark to show more information on how to solve the warning message. Try copying the snippet from the dialog and paste it in the data provider definition below:
To help you get started quickly, the grid is able to infer data provider fields if they are not defined. This allows you to quickly get started with a basic field definition based on the returned data. When a data provider is passed that doesn't have a field definiton, the grid infers field definitions and shows a warning. Click the question mark to show more information on how to solve the warning message. Try copying the snippet from the dialog and paste it in the data provider definition below:

{{"demo": "FieldInference.js"}}

Expand All @@ -42,25 +42,25 @@ You can decide whether your data provider supports pagination exclusively or opt

The data provider supports all basic CRUD operations

### Create
### Create a row

When you add a `createOne` method to the data provider, the grid gets a "Add record" button in the Toolbar. When you click this button, a draft row shows wich you can fill with values for the created item. To commit the new row, click the save button. This calls the `createOne` function with the values that were filled. When the operation finishes, a notification shows.

{{"demo": "CrudCreate.js"}}

### Update
### Update a row

When you add a `updateOne` method to the data provider, the grid gets edit buttons in its action column. When you click this button, the row goes in editing mode. When you click the save button, the `updateOne` method is called with the row id as first parameter and the changed values as the second parameter. When the operation finishes, a notification shows.

{{"demo": "CrudUpdate.js"}}

### Delete
### Delete a row

When you add a `deleteOne` method to your data provider, the grid gets delete buttons in its action column. When you click this button, the `deleteOne` method is called with the id of the relevant row. When the operation finishes, a notification shows.

{{"demo": "CrudDelete.js"}}

### 🚧 Delete multiple
### 🚧 Delete multiple rows

When the data provider contains a `deleteMany` method, the grid allows for multiple selection and delete.

Expand Down
1 change: 0 additions & 1 deletion docs/data/toolpad/core/components/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
- [Dashboard Layout](/toolpad/core/components/dashboard-layout/)
- [Data Grid](/toolpad/core/components/data-grid/)
- [Line Chart](/toolpad/core/components/line-chart/)
- [Select Filter](/toolpad/core/components/select-filter/)
6 changes: 1 addition & 5 deletions docs/data/toolpad/core/features/data-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Interface

A data provider is a stateless interface representing a collection of remote data. It mainly contains method to fetch and manipulate this data, along with certain additional methods for certain data providers.
A data provider is a stateless interface representing a collection of remote data. It mainly contains methods to fetch and manipulate this data, along with certain additional methods for certain data providers.

```tsx
import { createDataProvider } from '@toolpad/data';
Expand Down Expand Up @@ -34,10 +34,6 @@ const sharedDataSource = useSharedDataProvider(dataProvider, {
});
```

:::info
Find more details in the [connecting to components](/toolpad/data/connecting-to-components/) page
:::

## Server-side data providers

```tsx
Expand Down
54 changes: 54 additions & 0 deletions docs/data/toolpad/core/introduction/build-deploy.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
# Build and Deploy

<p class="description">With Toolpad Core, you can build and deploy on your own terms </p>

## Install step

Install required depdencies via:

<codeblock storageKey="package-manager">

```bash npm
npm install
```

```bash yarn
yarn
```

</codeblock>

## Build step

This command creates an optimized production build for the app and outputs the generated files:

<codeblock storageKey="package-manager">

```bash npm
npm run build
```

```bash yarn
yarn build
```

```bash pnpm
pnpm build
```

</codeblock>

## Start step

Once the build has been made, you can deploy it to any service of your choice!

To serve the app once built, run:

<codeblock storageKey="package-manager">

```bash npm
npm run start
```

```bash yarn
yarn start
```

</codeblock>
13 changes: 11 additions & 2 deletions docs/data/toolpad/core/introduction/examples.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Examples
---
productId: toolpad-core
title: Examples
---

<p class="description">Examples</p>
# Toolpad Core - Examples

<p class="description">Browse a collection of Toolpad Core examples to help you get started quickly:</p>

<!-- #default-branch-switch -->

{{"component": "modules/components/ExamplesGrid/ExamplesGrid.tsx", "examplesFile": "core-examples.ts"}}
75 changes: 73 additions & 2 deletions docs/data/toolpad/core/introduction/installation.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
# Installation
---
title: Toolpad Core - Installation
---

<p class="description">Installation</p>
# Toolpad Core - Installation

<p class="description">Learn how to install Toolpad Core in your local environment.</p>

1. Run the following command to start Toolpad Core:

<codeblock storageKey="package-manager">

```bash npm
npx create-toolpad-app@latest --core
```

```bash pnpm
pnpm create toolpad-app --core
```

```bash yarn
yarn create toolpad-app --core
```

</codeblock>

2. Follow the instructions presented. Once the installation ends, run:

<codeblock storageKey="package-manager">

```bash npm
cd <project-name>
npm run dev
```

```bash pnpm
cd <project-name>
pnpm run dev
```

```bash yarn
cd <project-name>
yarn dev
```

</codeblock>

3. Visit **http://localhost:3000/** in your browser to open the application.

4. The CLI bootstraps the following directory:

```bash
├── app
│ ├── auth
│ ├──── [...path]
│ └────── page.tsx
│ ├── api
│ ├──── auth
│ ├────── [...nextAuth]
│ └───────── route.tsx
│ ├── (dashboard)
| ├──── layout.tsx
│ ├──── page
│ └────── page.tsx
├──── layout.tsx
└──── page.tsx

```

and the following page appears when you run the project locally:

{{"component": "modules/components/DocsImage.tsx", "src": "/static/toolpad/docs/core/installation-1.png", "alt": "Toolpad Core entry point", "caption": "Starting with Toolpad Core", "zoom": true, "indent": 1 }}

5. Installation is complete! Begin building your project by making edits to `(dashboard/page/page.tsx`. To understand how to leverage Toolpad Core to build dashboards quickly, [see the detailed tutorial](/toolpad/core/introduction/tutorial/).
Loading
Loading