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

Add list, datepicker and textfield component guides #2827

Merged
merged 50 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0369196
add
prakhargupta1 Sep 14, 2023
616c15d
add-backend-code section
prakhargupta1 Sep 14, 2023
3395651
wer
prakhargupta1 Sep 14, 2023
5d7b16a
Use @mui/toolpad-components
Janpot Sep 18, 2023
da542ad
more demos
prakhargupta1 Sep 21, 2023
e4e09e0
edits
prakhargupta1 Sep 21, 2023
353f3cd
add datagrid guide
prakhargupta1 Sep 22, 2023
e4ce9b8
dhgjg
prakhargupta1 Sep 22, 2023
0cec0df
resolve conflict
prakhargupta1 Sep 22, 2023
499df41
Merge branch 'master' into button-component-guide
prakhargupta1 Sep 25, 2023
0bd02f4
try new netlify
Janpot Sep 26, 2023
bbb2ac9
fix
Janpot Sep 26, 2023
1924ee9
lint
Janpot Sep 26, 2023
faad325
update
prakhargupta1 Oct 9, 2023
32bdc23
add event-handling page
prakhargupta1 Oct 9, 2023
9281414
data binding
prakhargupta1 Oct 10, 2023
fb7d161
data-binding and event-handling
prakhargupta1 Oct 13, 2023
a63703b
dasda
prakhargupta1 Oct 13, 2023
039c6b8
update video
prakhargupta1 Oct 13, 2023
48fd6ea
fix-paths
prakhargupta1 Oct 13, 2023
0b8d012
Merge remote-tracking branch 'upstream/master' into pr/2678
Janpot Oct 13, 2023
6292302
fix links
prakhargupta1 Oct 13, 2023
5ea7161
Update DataGrid.tsx
Janpot Oct 13, 2023
bd58ad2
add-folder
prakhargupta1 Oct 17, 2023
df33cff
add
prakhargupta1 Oct 23, 2023
f1bb83c
add
prakhargupta1 Oct 24, 2023
9041c4f
reorder
prakhargupta1 Nov 23, 2023
bf6bab8
Merge branch 'master' into list-datepicker-textfield
prakhargupta1 Nov 23, 2023
8dc4b00
add
prakhargupta1 Nov 23, 2023
2ab39f8
add api
prakhargupta1 Nov 24, 2023
7bf14dd
Merge branch 'master' into list-datepicker-textfield
prakhargupta1 Nov 24, 2023
1290f58
Merge branch 'master' into list-datepicker-textfield
prakhargupta1 Dec 6, 2023
ecbe6c3
delete yarn.lock
prakhargupta1 Feb 27, 2024
48a366b
Merge branch 'master' into list-datepicker-textfield
prakhargupta1 Feb 27, 2024
19af63c
isInvalid
prakhargupta1 Feb 27, 2024
8cb0ed0
Merge branch 'list-datepicker-textfield' of https://github.com/prakha…
prakhargupta1 Feb 27, 2024
c38d6a8
Apply suggestions from code review
prakhargupta1 Feb 27, 2024
1475956
fix date adapter SSR
Janpot Feb 27, 2024
cd6dff6
Update DatePicker.tsx
Janpot Feb 27, 2024
393864f
Apply suggestions from code review
prakhargupta1 Feb 27, 2024
7f32617
add hyphen
prakhargupta1 Feb 27, 2024
fed57ed
make onChange optional
Janpot Feb 27, 2024
0ffae36
Update DatePickerFormat.js
Janpot Feb 27, 2024
24d39f5
remove property objects
prakhargupta1 Feb 27, 2024
7e7c0a4
add hyphen in folder names
prakhargupta1 Feb 27, 2024
6f0e260
prettier
prakhargupta1 Feb 27, 2024
c33875e
add vale suggestions
prakhargupta1 Feb 27, 2024
27e6f3a
remove isInvalid prop from docs
prakhargupta1 Feb 28, 2024
ae951a0
remove demo from list component
prakhargupta1 Feb 29, 2024
f1716e9
Merge branch 'master' into list-datepicker-textfield
Janpot Mar 1, 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
11 changes: 7 additions & 4 deletions docs/data/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ const pages: MuiPage[] = [
pathname: '/toolpad/components',
children: [
{ pathname: '/toolpad/components/button' },
{
pathname: '/toolpad/components/datagrid',
title: 'Data Grid',
},
{ pathname: '/toolpad/components/data-grid',
title: 'DataGrid', },
{ pathname: '/toolpad/components/list' },
{ pathname: '/toolpad/components/date-picker',
title: 'DatePicker', },
{ pathname: '/toolpad/components/text-field',
title: 'TextField', },
],
},
{
Expand Down
11 changes: 11 additions & 0 deletions docs/data/toolpad/components/datepicker/DatePicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as React from 'react';
import { DatePicker } from '@mui/toolpad-components';

const TOOLPAD_PROPS = {
label: 'Enter date',
size: 'small',
};

export default function BasicDatepicker() {
return <DatePicker {...TOOLPAD_PROPS} />;
}
26 changes: 26 additions & 0 deletions docs/data/toolpad/components/datepicker/DatePickerDisabled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import { DatePicker } from '@mui/toolpad-components';
import { Stack } from '@mui/material';

const TOOLPAD_PROPS1 = {
variant: 'outlined',
size: 'small',
disabled: true,
label: 'Disabled',
};

const TOOLPAD_PROPS2 = {
prakhargupta1 marked this conversation as resolved.
Show resolved Hide resolved
variant: 'outlined',
label: 'Active',
size: 'small',
disabled: false,
};

export default function BasicButton() {
return (
<Stack spacing={2} direction="row" alignItems="center">
<DatePicker {...TOOLPAD_PROPS1} />
<DatePicker {...TOOLPAD_PROPS2} />
</Stack>
);
}
27 changes: 27 additions & 0 deletions docs/data/toolpad/components/datepicker/DatePickerFormat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as React from 'react';
import { DatePicker } from '@mui/toolpad-components';
import { Stack } from '@mui/material';

const TOOLPAD_PROPS1 = {
size: 'small',
variant: 'outlined',
label: 'MM/dd/yyyy',
format: 'MM/dd/yyyy',
};

const TOOLPAD_PROPS2 = {
size: 'small',
variant: 'outlined',
label: 'MMMM-YY',
format: 'MMMM-YY',
// defaultValue: '2017-05-24',
};

export default function BasicButton() {
return (
<Stack spacing={2} direction="row" alignItems="center">
<DatePicker {...TOOLPAD_PROPS1} />
<DatePicker {...TOOLPAD_PROPS2} />
</Stack>
);
}
24 changes: 24 additions & 0 deletions docs/data/toolpad/components/datepicker/DatePickerSize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';
import { DatePicker } from '@mui/toolpad-components';
import { Stack } from '@mui/material';

const TOOLPAD_PROPS1 = {
size: 'small',
variant: 'outlined',
label: 'Small',
};

const TOOLPAD_PROPS2 = {
size: 'medium',
variant: 'outlined',
label: 'Medium',
};

export default function BasicButton() {
return (
<Stack spacing={2} direction="row" alignItems="center">
<DatePicker {...TOOLPAD_PROPS1} />
<DatePicker {...TOOLPAD_PROPS2} />
</Stack>
);
}
31 changes: 31 additions & 0 deletions docs/data/toolpad/components/datepicker/DatePickerVariant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as React from 'react';
import { DatePicker } from '@mui/toolpad-components';
import { Stack } from '@mui/material';

const TOOLPAD_PROPS1 = {
size: 'small',
variant: 'outlined',
label: 'Outlined',
};

const TOOLPAD_PROPS2 = {
size: 'small',
variant: 'filled',
label: 'Filled',
};

const TOOLPAD_PROPS3 = {
size: 'small',
variant: 'standard',
label: 'Standard',
};

export default function BasicButton() {
return (
<Stack spacing={2} direction="row" alignItems="center">
<DatePicker {...TOOLPAD_PROPS1} />
<DatePicker {...TOOLPAD_PROPS2} />
<DatePicker {...TOOLPAD_PROPS3} />
</Stack>
);
}
87 changes: 87 additions & 0 deletions docs/data/toolpad/components/datepicker/date-picker.md
prakhargupta1 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# DatePicker

<p class="description">Learn about the datepicker component and its usage in Toolpad.</p>

## Demo

DatePicker is an input component. It takes user input and provides the value for further usage on the page.

{{"demo": "DatePicker.js", "hideToolbar": true}}

## Usage

Below props makes it usable:

### format

The [format](https://day.js.org/docs/en/display/format) of the date in the UI. The value for the bindings will always be in the YYYY-MM-DD format. Leave empty to let the end-user locale define the format.

{{"demo": "DatePickerFormat.js", "hideToolbar": true}}

### value

The current selected date. It shows the format in which it is being provided to the page: YYYY-MM-DD.

### defaultValue

Allows setting a default value. Example:

<video controls width="100%" height="auto" style="contain" alt="button-onclick-js-expression">
<source src="/static/toolpad/docs/components/datepicker/datepicker-defaultValue.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

### name

A name is needed when a textfield is part of a form component. It is used to show validation errors.

## Appearance

The DatePicker component has some appearance related props supported in Toolpad. Let's look at each of these below:

### label

A label that describes the content of the datepicker. Eg: Enter date.

### variant

The variant property supports three different options: outlined (default), filled and standard. Outlined is for low-emphasis while Filled is a high-emphasis input. Standard is used for less-pronounced actions that ensure user remains focused on the main content.

{{"demo": "DatePickerVariant.js", "hideToolbar": true}}

### size

The size property supports two options: small (default) and medium.

{{"demo": "DatePickerSize.js", "hideToolbar": true}}

### fullWidth

This boolean defines if the component should take the full width of the page.

### disabled

Disabled property shows the state of the component so that end user is aware that can't interact with the component.

{{"demo": "DatePickerDisabled.js", "hideToolbar": true}}

## Validation

### isRequired

isRequired is useful when the action can't be perfomed without a user provided date.

<video controls width="100%" height="auto" style="contain" alt="button-onclick-js-expression">
<source src="/static/toolpad/docs/components/datepicker/datepicker-validation.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

### isInvalid

If isInvalid is set to true it will show an error no matter what the input is.

## API

See the documentation below for a complete reference to all props available to the datepicker component in Toolpad.

- [`<datepicker />`](/toolpad/reference/components/date-picker/#properties)
10 changes: 10 additions & 0 deletions docs/data/toolpad/components/list/List.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react';
import { List } from '@mui/toolpad-components';

const TOOLPAD_PROPS = {
itemCount: 2,
};

export default function BasicList() {
return <List {...TOOLPAD_PROPS} />;
}
38 changes: 38 additions & 0 deletions docs/data/toolpad/components/list/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# List

<p class="description">Learn about the list component and its usage in Toolpad.</p>

## Demo

List makes it easy to configure a recurring pattern of data.

<!---
Add demo
-->

## Usage

A List is an essential component in an application. It had one key property that makes it usable:

### itemCount

It is the number of occurences that the list is supposed to render.

<video controls width="100%" height="auto" style="contain" alt="button-onclick-js-expression">
<source src="/static/toolpad/docs/components/list/list.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

## Appearance

The List component acts as a mini canvas for other components. Each component has its own styling. The first occurence decides the appearance for the entire list.

### disablePadding

There is a predefined padding that can be enabled or disabled. It is a boolean.

## API

See the documentation below for a complete reference to all props available to the list component in Toolpad.

- [`<list />`](/toolpad/reference/components/list/#properties)
12 changes: 12 additions & 0 deletions docs/data/toolpad/components/textfield/TextField.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { TextField } from '@mui/toolpad-components';

const TOOLPAD_PROPS = {
label: 'Enter name',
size: 'small',
placeholder: 'This is a placeholder',
};

export default function BasicDatepicker() {
return <TextField {...TOOLPAD_PROPS} />;
}
26 changes: 26 additions & 0 deletions docs/data/toolpad/components/textfield/TextFieldDisabled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import { TextField } from '@mui/toolpad-components';
import { Stack } from '@mui/material';

const TOOLPAD_PROPS1 = {
variant: 'outlined',
size: 'small',
disabled: true,
label: 'Disabled',
};

const TOOLPAD_PROPS2 = {
variant: 'outlined',
label: 'Active',
size: 'small',
disabled: false,
};

export default function BasicButton() {
return (
<Stack spacing={2} direction="row" alignItems="center">
<TextField {...TOOLPAD_PROPS1} />
<TextField {...TOOLPAD_PROPS2} />
</Stack>
);
}
24 changes: 24 additions & 0 deletions docs/data/toolpad/components/textfield/TextFieldSize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';
import { TextField } from '@mui/toolpad-components';
import { Stack } from '@mui/material';

const TOOLPAD_PROPS1 = {
size: 'small',
variant: 'outlined',
label: 'Small',
};

const TOOLPAD_PROPS2 = {
size: 'medium',
variant: 'outlined',
label: 'Medium',
};

export default function BasicButton() {
return (
<Stack spacing={2} direction="row" alignItems="center">
<TextField {...TOOLPAD_PROPS1} />
<TextField {...TOOLPAD_PROPS2} />
</Stack>
);
}
31 changes: 31 additions & 0 deletions docs/data/toolpad/components/textfield/TextFieldVariant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as React from 'react';
import { TextField } from '@mui/toolpad-components';
import { Stack } from '@mui/material';

const TOOLPAD_PROPS1 = {
size: 'small',
variant: 'outlined',
label: 'Outlined',
};

const TOOLPAD_PROPS2 = {
size: 'small',
variant: 'filled',
label: 'Filled',
};

const TOOLPAD_PROPS3 = {
size: 'small',
variant: 'standard',
label: 'Standard',
};

export default function BasicButton() {
return (
<Stack spacing={2} direction="row" alignItems="center">
<TextField {...TOOLPAD_PROPS1} />
<TextField {...TOOLPAD_PROPS2} />
<TextField {...TOOLPAD_PROPS3} />
</Stack>
);
}
Loading
Loading