|
| 1 | +--- |
| 2 | +title: Remix Development Tools Client Configuration |
| 3 | +description: Configuration options for the Remix Development Tools client |
| 4 | +--- |
| 5 | + |
| 6 | +import Info from "./info.tsx"; |
| 7 | +import Warn from "./warn.tsx"; |
| 8 | + |
| 9 | +<Info> |
| 10 | +All of the following options can be set in the dev tools panel **"Settings page"** and they override the default ones. Your preferences are |
| 11 | +stored in localStorage and if they do not exist there the default ones are used. |
| 12 | +</Info> |
| 13 | + |
| 14 | +Before we explain all the possible options here is the client configuration Typescript type: |
| 15 | + |
| 16 | +```ts |
| 17 | +type RdtClientConfig = { |
| 18 | + position: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "middle-left" | "middle-right"; |
| 19 | + liveUrls: { name: string, url: string }[]; |
| 20 | + liveUrlsPosition: "top-left" | "top-right" | "bottom-left" | "bottom-right"; |
| 21 | + defaultOpen: boolean; |
| 22 | + expansionLevel: number; |
| 23 | + height: number; |
| 24 | + minHeight: number; |
| 25 | + maxHeight: number; |
| 26 | + hideUntilHover: boolean; |
| 27 | + panelLocation: "top" | "bottom"; |
| 28 | + requireUrlFlag: boolean; |
| 29 | + urlFlag: string; |
| 30 | + breakpoints: {name: string, min: number, max: number }[], |
| 31 | + routeBoundaryGradient: "sea" | "hyper" | "gotham" | "gray" | "watermelon" | "ice" | "silver"; |
| 32 | + showBreakpointIndicator: boolean; |
| 33 | +} |
| 34 | +``` |
| 35 | +
|
| 36 | +Let's go through each option and see what it does. |
| 37 | +
|
| 38 | +## Live URLs |
| 39 | +
|
| 40 | +This option is used to set the live urls that will be displayed in the bottom left corner of the screen. The default value is an empty array. |
| 41 | +It allows you to specify multiple live urls that you can use to open the current page in a new tab. |
| 42 | +
|
| 43 | +## Live URLs position |
| 44 | +
|
| 45 | +This option is used to set the position of the live urls that will be displayed in the bottom left corner of the screen. The possible values are: |
| 46 | +- `top-left` - the live urls will be positioned at the top left corner of the screen |
| 47 | +- `top-right` - the live urls will be positioned at the top right corner of the screen |
| 48 | +- `bottom-left` - the live urls will be positioned at the bottom left corner of the screen |
| 49 | +- `bottom-right` - the live urls will be positioned at the bottom right corner of the screen |
| 50 | +
|
| 51 | +## Position |
| 52 | +
|
| 53 | +This option is used to set the position of the Remix Development Tools trigger (the button that opens the panel). The possible values are: |
| 54 | +- `top-left` - the trigger will be positioned at the top left corner of the screen |
| 55 | +- `top-right` - the trigger will be positioned at the top right corner of the screen |
| 56 | +- `bottom-left` - the trigger will be positioned at the bottom left corner of the screen |
| 57 | +- `bottom-right` - the trigger will be positioned at the bottom right corner of the screen |
| 58 | +- `middle-left` - the trigger will be positioned at the middle left of the screen |
| 59 | +- `middle-right` - the trigger will be positioned at the middle right of the screen |
| 60 | +
|
| 61 | +## Default Open |
| 62 | +
|
| 63 | +This option is used to set the initial state of the panel. If set to `true` the panel will be open by default, if set to `false` |
| 64 | +the panel will be closed by default. |
| 65 | +
|
| 66 | +## Expansion Level |
| 67 | +
|
| 68 | +This option is used to set the initial expansion level of the returned JSON data in the **Active Page** tab. By default it is set to |
| 69 | +0 and if you open up the **Active Page** and look at the returned loader data it will look like this: |
| 70 | +
|
| 71 | +```ts |
| 72 | +"data": { ... } + |
| 73 | +``` |
| 74 | +
|
| 75 | +If you set the expansion level to 1 the returned loader data will look like this: |
| 76 | +
|
| 77 | +```ts |
| 78 | +"data": { |
| 79 | + "property": "value" |
| 80 | +} |
| 81 | +``` |
| 82 | +
|
| 83 | +## Height |
| 84 | +
|
| 85 | +This option is used to set the initial height of the panel. The default value is 400px. |
| 86 | +
|
| 87 | +## Min Height |
| 88 | +
|
| 89 | +This option is used to set the minimum height of the panel. The default value is 200px. |
| 90 | +
|
| 91 | +## Max Height |
| 92 | +
|
| 93 | +This option is used to set the maximum height of the panel. The default value is 800px. |
| 94 | +
|
| 95 | +## Hide Until Hover |
| 96 | +
|
| 97 | +This option is used to set whether the trigger should be hidden until you hover over it. The default value is `false`. |
| 98 | +
|
| 99 | +## Panel Location |
| 100 | +
|
| 101 | +This option is used to set the location of the panel. The possible values are: |
| 102 | +- `top` - the panel will be positioned at the top of the screen |
| 103 | +- `bottom` - the panel will be positioned at the bottom of the screen |
| 104 | +
|
| 105 | +## Require URL Flag |
| 106 | +
|
| 107 | +This option is used to set whether the panel should be opened only if the URL contains a specific flag. The default value is `false`. |
| 108 | +
|
| 109 | +<Warn title="Be careful!"> |
| 110 | +If you set this option to `true` and you forget to set the URL flag, the panel will hide and you will not be able to see it |
| 111 | +until you enter the url flag. |
| 112 | +
|
| 113 | +The default one is `rdt=true` and if you set this option to `true` you will have to add `?rdt=true` to the URL in order to see the panel. |
| 114 | +</Warn> |
| 115 | +
|
| 116 | +## URL Flag |
| 117 | +
|
| 118 | +This option is used to set the URL flag that is required to open the panel. The default value is `rdt`. |
| 119 | +
|
| 120 | +You can set it to whatever you wish and if you set the **Require URL Flag** option to `true` you will have to add `?yourFlag=true` to the URL in order to see the panel. |
| 121 | +
|
| 122 | +## Route Boundary Gradient |
| 123 | +
|
| 124 | +This option is used to set the color of the route boundary gradient. The possible values are: |
| 125 | +- `sea` |
| 126 | +- `hyper` |
| 127 | +- `gotham` |
| 128 | +- `gray` |
| 129 | +- `watermelon` |
| 130 | +- `ice` |
| 131 | +- `silver` |
| 132 | +
|
| 133 | +<Info> |
| 134 | +This changes the color of the route boundary gradient in the **Active Page** tab. When you hover over any route in the panel it will show you it's boundaries. |
| 135 | +</Info> |
| 136 | +
|
| 137 | +The default value is `ice`. |
| 138 | +
|
| 139 | +## Breakpoints |
| 140 | +
|
| 141 | +This option allows you to define custom breakpoints that show in the bottom left corner of the panel to help you determine the current screen breakpoint you have defined. |
| 142 | +By default the breakpoints are set to tailwind breakpoints but you can change them to whatever you want. |
| 143 | +
|
| 144 | +Eg: |
| 145 | +```ts |
| 146 | + breakpoints: [{name: "lg", min: 0, max: 768}, {name: "xl", min: 768, max: 1024}, {name: "2xl", min: 1024, max: Infinity}], |
| 147 | +``` |
| 148 | +
|
| 149 | +## Show breakpoint indicator |
| 150 | +
|
| 151 | +This option allows you to show/hide the current breakpoint in the bottom left corner of the panel. |
| 152 | +
|
| 153 | +## Creating a custom configuration |
| 154 | +
|
| 155 | +To create a custom configuration you can use the following code snippet: |
| 156 | + |
| 157 | + ```ts |
| 158 | + import { defineRdtConfig } from "remix-development-tools"; |
| 159 | + |
| 160 | + const customConfig = defineRdtConfig({ |
| 161 | + client: { |
| 162 | + position: "top-right", |
| 163 | + defaultOpen: true, |
| 164 | + expansionLevel: 1, |
| 165 | + height: 500, |
| 166 | + minHeight: 300, |
| 167 | + maxHeight: 1000, |
| 168 | + hideUntilHover: true, |
| 169 | + panelLocation: "bottom", |
| 170 | + requireUrlFlag: true, |
| 171 | + urlFlag: "customFlag", |
| 172 | + routeBoundaryGradient: "gotham", |
| 173 | + breakpoints: [{name: "lg", min: 0, max: 768}, {name: "xl", min: 768, max: 1024}, {name: "2xl", min: 1024, max: Infinity}], |
| 174 | + showBreakpointIndicator: false |
| 175 | + } |
| 176 | + }); |
| 177 | + |
| 178 | + export default customConfig; |
| 179 | + ``` |
| 180 | + |
| 181 | +Then you can use this configuration in your `vite.config.js` file like this: |
| 182 | + |
| 183 | +```ts |
| 184 | +import customConfig from "./rdt.config"; |
| 185 | +import { remixDevTools } from "remix-development-tools"; |
| 186 | + |
| 187 | +export default defineConfig({ |
| 188 | + plugins: [remixDevTools(customConfig)], |
| 189 | +}); |
| 190 | +``` |
| 191 | + |
| 192 | +<Info title="Try it out!"> |
| 193 | + Try opening up the dev tools panel deployed on this site and playing around with the settings in the settings tab! |
| 194 | +</Info> |
| 195 | + |
0 commit comments