Skip to content

Commit 2b99b77

Browse files
committed
chore(docs): cleanup theming examples
1 parent b493893 commit 2b99b77

File tree

2 files changed

+11
-45
lines changed

2 files changed

+11
-45
lines changed

docs/src/guide/node.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ import { VueFlow } from '@vue-flow/core'
6868
const elements = ref([
6969
{
7070
id: '1',
71-
position: {x: 50, y: 50},
71+
position: { x: 50, y: 50 },
7272
label: 'Node 1',
7373
}
7474
]);
@@ -77,7 +77,7 @@ onMounted(() => {
7777
elements.value.push({
7878
id: '2',
7979
label: 'Node 2',
80-
position: {x: 150, y: 50},
80+
position: { x: 150, y: 50 },
8181
})
8282
})
8383
</script>

docs/src/guide/theming.md

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup>
22
import LogosJavascript from '~icons/logos/javascript';
3-
import LogosTypescript from '~icons/logos/typescript-icon';
43
import { ref, h } from 'vue';
54
import { Handle, Position, VueFlow } from '@vue-flow/core';
5+
import { Background } from '@vue-flow/background';
66

77
const CustomNode = (props) => h('div', [
88
h(Handle, { connectable: false, type: 'target', position: Position.Top }),
@@ -60,10 +60,11 @@ Here's how you can use CSS classes to add a pop of color or alter the font style
6060
```
6161

6262
<div class="mt-4 bg-[var(--vp-code-block-bg)] rounded-lg h-50">
63-
<VueFlow v-model="elements" :pan-activation-key-code="null" :pan-on-scroll="false" :zoom-on-scroll="false" :pan-on-drag="false" fit-view-on-init>
63+
<VueFlow v-model="elements" fit-view-on-init>
6464
<template #node-custom="props">
6565
<CustomNode v-bind="props" />
6666
</template>
67+
<Background />
6768
</VueFlow>
6869
</div>
6970

@@ -86,14 +87,12 @@ Below are a couple of examples on how you can do this:
8687

8788
Directly styling the Vue Flow component:
8889

89-
```html{4-5}
90-
<div style="height: 300px">
91-
<VueFlow
92-
v-model="elements"
93-
class="my-diagram-class"
94-
:style="{ background: 'red' }"
95-
/>
96-
</div>
90+
```vue{3-4}
91+
<VueFlow
92+
v-model="elements"
93+
class="my-diagram-class"
94+
:style="{ background: 'red' }"
95+
/>
9796
```
9897

9998
Styling nodes/edges with a style or class attribute:
@@ -117,25 +116,6 @@ const nodes = ref([
117116
])
118117
```
119118

120-
```ts{10-14} [<LogosTypescript />]
121-
import type { Node } from '@vue-flow/core';
122-
123-
/* Customizing node by assigning class and style properties */
124-
const nodes = ref<Node[]>([
125-
{
126-
id: '1',
127-
label: 'Node 1',
128-
position: { x: 250, y: 5 },
129-
130-
// Add a class name to the node
131-
class: 'my-custom-node-class',
132-
133-
// You can pass an object containing CSSProperties or CSS variables
134-
style: { backgroundColor: 'green', width: '200px', height: '100px' },
135-
},
136-
])
137-
```
138-
139119
:::
140120

141121
### [Redefining Styles with CSS variables](/typedocs/types/CSSVars)
@@ -167,20 +147,6 @@ const elements = ref([
167147
])
168148
```
169149

170-
```ts{8-9} [<LogosTypescript />]
171-
import type { Elements } from '@vue-flow/core';
172-
173-
const elements = ref<Elements>([
174-
{
175-
id: '1',
176-
label: 'Node 1',
177-
position: { x: 100, y: 100 },
178-
/* Overriding the `--vf-node-color` variable to change node border, box-shadow and handle color */
179-
style: { '--vf-node-color': 'blue' }
180-
},
181-
])
182-
```
183-
184150
:::
185151

186152
## CSS Variables

0 commit comments

Comments
 (0)