@ -15,15 +15,19 @@ Please add the latest change on the top under the correct section.
@@ -15,15 +15,19 @@ Please add the latest change on the top under the correct section.
### Features
- Any top-level children passed to the `<Excalidraw/>` component that do not belong to one of the officially supported Excalidraw children components are now rendered directly inside the Excalidraw container (previously, they weren't rendered at all) [#6096](https://github.com/excalidraw/excalidraw/pull/6096).
- Support customization for the editor [welcome screen](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#WelcomeScreen) [#6048](https://github.com/excalidraw/excalidraw/pull/6048).
- Expose component API for the Excalidraw main menu [#6034](https://github.com/excalidraw/excalidraw/pull/6034), You can read more about its usage [here](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#MainMenu)
- Render Footer as a component instead of render prop [#5970](https://github.com/excalidraw/excalidraw/pull/5970). You can read more about its usage [here](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#Footer)
- Support customization for the Excalidraw [main menu](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#MainMenu) [#6034](https://github.com/excalidraw/excalidraw/pull/6034).
- [Footer](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#Footer) is now rendered as child component instead of passed as a render prop [#5970](https://github.com/excalidraw/excalidraw/pull/5970).
- Any top-level children passed to the `<Excalidraw/>` component that do not belong to one of the officially supported Excalidraw children components are now rendered directly inside the Excalidraw container (previously, they weren't rendered at all) [#6096](https://github.com/excalidraw/excalidraw/pull/6096).
#### BREAKING CHANGE
- With this change, the prop `renderFooter` is now removed.
- The prop `renderFooter` is now removed in favor of rendering as a child component.
@ -376,7 +376,7 @@ Most notably, you can customize the primary colors, by overriding these variable
@@ -376,7 +376,7 @@ Most notably, you can customize the primary colors, by overriding these variable
For a complete list of variables, check [theme.scss](https://github.com/excalidraw/excalidraw/blob/master/src/css/theme.scss), though most of them will not make sense to override.
### Does this package support collaboration?
### Does this package support collaboration?
No, Excalidraw package doesn't come with collaboration built in, since the implementation is specific to each host app. We expose APIs which you can use to communicate with Excalidraw which you can use to implement it. You can check our own implementation [here](https://github.com/excalidraw/excalidraw/blob/master/src/excalidraw-app/index.tsx).
For `mobile` you will need to render it inside the [MainMenu](#mainmenu). You can use the [`useDevice`](#useDevice) hook to check the type of device, this will be available only inside the `children` of `Excalidraw` component.
In the mobile view you can render it inside the [MainMenu](#mainmenu) (later we will expose other ways to customize the UI). You can use the [`useDevice`](#useDevice) hook to check the type of device, this will be available only inside the `children` of `Excalidraw` component.
```js
import { useDevice, Footer } from "@excalidraw/excalidraw";
const MobileFooter = ({
}) => {
const MobileFooter = () => {
const device = useDevice();
if (device.isMobile) {
return (
<Footer>
<button
className="custom-footer"
onClick={() => alert("This is custom footer in mobile menu")}
>
{" "}
custom footer{" "}
</button>
<button
className="custom-footer"
onClick={() => alert("This is custom footer in mobile menu")}
@ -469,28 +475,28 @@ This is the `MainMenu` component which you need to import to render the menu wit
@@ -469,28 +475,28 @@ This is the `MainMenu` component which you need to import to render the menu wit
**MainMenu.Item**
To render an item, its recommended to use `MainMenu.Item`.
| `href` | `string` | Yes | `undefined` | The `href` attribute to be added to the `anchor` element. |
| `children` | `React.ReactNode` | Yes | `undefined` | The content of the menu item |
| `icon` | `JSX.Element` | No | `undefined` | The icon used in the menu item |
| `shortcut` | `string` | No | `undefined` | The shortcut to be shown for the menu item |
| `href` | `string` | Yes | | The `href` attribute to be added to the `anchor` element. |
| `children` | `React.ReactNode` | Yes | | The content of the menu item |
| `icon` | `JSX.Element` | No | | The icon used in the menu item |
| `shortcut` | `string` | No | | The keyboard shortcut (label-only, does not affect behavior) |
| `className` | `string` | No | "" | The class names to be added to the menu item |
| `style` | `React.CSSProperties` | No | `undefined` | The inline styles to be added to the menu item |
| `ariaLabel` | `string` | No | `undefined` | The `aria-label` to be added to the item for accessibility |
| `dataTestId` | `string` | No | `undefined` | The `data-testid` to be added to the item. |
| `style` | `React.CSSProperties` | No | | The inline styles to be added to the menu item |
| `ariaLabel` | `string` | No | | The `aria-label` to be added to the item for accessibility |
| `dataTestId` | `string` | No | | The `data-testid` to be added to the item. |
**MainMenu.ItemCustom**
@ -521,7 +527,7 @@ To render a custom item, you can use `MainMenu.ItemCustom`.
@@ -521,7 +527,7 @@ To render a custom item, you can use `MainMenu.ItemCustom`.
```js
import { MainMenu } from "@excalidraw/excalidraw";
@ -551,7 +557,7 @@ For the items which are shown in the menu in [excalidraw.com](https://excalidraw
@@ -551,7 +557,7 @@ For the items which are shown in the menu in [excalidraw.com](https://excalidraw
```js
import { MainMenu } from "@excalidraw/excalidraw";
Here is a [complete list](https://github.com/excalidraw/excalidraw/blob/master/src/components/mainMenu/DefaultItems.tsx) of the default items.
@ -571,7 +577,7 @@ To Group item in the main menu, you can use `MainMenu.Group`
@@ -571,7 +577,7 @@ To Group item in the main menu, you can use `MainMenu.Group`
```js
import { MainMenu } from "@excalidraw/excalidraw";
| `children ` | `React.ReactNode` | Yes | `undefined` | The content of the `Menu Group` |
| `children ` | `React.ReactNode` | Yes | `undefined` | The content of the `MenuItem Group` |
| `title` | `string` | No | `undefined` | The `title` for the grouped items |
| `className` | `string` | No | "" | The `classname` to be added to the group |
| `style` | `React.CSsSProperties` | No | `undefined` | The inline `styles` to be added to the group |
### WelcomeScreen
When the canvas is empty, Excalidraw shows a welcome "splash" screen with a logo, a few quick action items, and hints explaining what some of the UI buttons do. You can customize the welcome screen by rendering the `WelcomeScreen` component inside your Excalidraw instance.
You can also disable the welcome screen altogether by setting `UIOptions.welcomeScreen` to `false`.
**Usage**
```jsx
import { WelcomScreen } from "@excalidraw/excalidraw";
This is the center piece of the welcome screen, containing the logo, heading, and menu. All three sub-components are optional, and you can render whatever you wish into the center component.
**WelcomeScreen.Center.Logo**
By default renders the Excalidraw logo and name. Supply `children` to customize.
**WelcomeScreen.Center.Heading**
Supply `children` to change the default message.
**WelcomeScreen.Center.Menu**
Wrapper component for the menu items. You can build your menu using the `<WelcomeScreen.Center.MenuItem>` and `<WelcomeScreen.Center.MenuItemLink>` components, render your own, or render one of the default menu items.
The default menu items are:
- `<WelcomeScreen.Center.MenuItemHelp/>` - opens the help dialog.
- `<WelcomeScreen.Center.MenuItemLoadScene/>` - open the load file dialog.
**Usage**
```jsx
import { WelcomScreen } from "@excalidraw/excalidraw";
| `href` | `string` | Yes | | The `href` attribute to be added to the `anchor` element. |
| `children` | `React.ReactNode` | Yes | | The content of the menu item |
| `icon` | `JSX.Element` | No | | The icon used in the menu item |
| `shortcut` | `string` | No | | The keyboard shortcut (label-only, does not affect behavior) |
**WelcomeScreen.Hints**
These subcomponents render the UI hints. Text of each hint can be customized by supplying `children`.
**WelcomeScreen.Hints.Menu**
Hint for the main menu. Supply `children` to customize the hint text.
**WelcomeScreen.Hints.Toolbar**
Hint for the toolbar. Supply `children` to customize the hint text.
**WelcomeScreen.Hints.Help**
Hint for the help dialog. Supply `children` to customize the hint text.
### Props
| Name | Type | Default | Description |
@ -1565,8 +1704,7 @@ This hook can be used to check the type of device which is being used. It can on
@@ -1565,8 +1704,7 @@ This hook can be used to check the type of device which is being used. It can on
```js
import { useDevice, Footer } from "@excalidraw/excalidraw";