Skip to Content
Vue Flow v2 is here and joins xyflow! Read more here →
ExamplesNodes

Connection Limit

This is an example of a custom node with a custom handle that can limit the amount of connections a handle can have using the isConnectable prop.

/* Extras for the xyflow examples. These styles sit on top of `@xyflow/vue/xy-theme.css`, which has to be imported before this file. They only add what the library theme doesn't ship with. */ .vue-flow__panel { color: var(--xy-theme-panel-text); } .vue-flow__node { box-shadow: var(--xy-node-boxshadow-default); } .vue-flow__node-resizer { border-radius: 0; border: none; } /* Custom Example CSS - This CSS is to improve the example experience. You can remove it if you want to use the default styles. New Theme Classes: .xy-theme__button - Styles for buttons. .xy-theme__input - Styles for text inputs. .xy-theme__checkbox - Styles for checkboxes. .xy-theme__select - Styles for dropdown selects. .xy-theme__label - Styles for labels. .xy-theme__range - Styles for range sliders (set --range-progress for the filled part). Use these classes to apply consistent theming across your components. */ :root { --color-primary: var(--xy-theme-primary); --color-background: light-dark(#fefefe, #1a1b1e); --color-hover-bg: light-dark(#f6f6f6, #24262c); --color-disabled: light-dark(#76797e, #8b9099); --color-primary-muted: color-mix( in srgb, var(--color-primary) 40%, transparent ); --color-primary-focus: color-mix( in srgb, var(--color-primary) 30%, transparent ); } .xy-theme__button-group { display: flex; align-items: center; .xy-theme__button:first-child { border-radius: 100px 0 0 100px; } .xy-theme__button:last-child { border-radius: 0 100px 100px 0; margin: 0; } } /* Custom Button Styling */ .xy-theme__button { display: inline-flex; align-items: center; justify-content: center; height: 2.5rem; padding: 0 1rem; border-radius: 100px; border: 1px solid var(--color-primary); background-color: var(--color-background); color: var(--color-primary); transition: background-color 0.2s ease, border-color 0.2s ease; box-shadow: var(--xy-node-boxshadow-default); cursor: pointer; } .xy-theme__button.active { background-color: var(--color-primary); color: white; border-color: var(--color-primary); } .xy-theme__button.active:hover, .xy-theme__button.active:active { background-color: var(--color-primary); opacity: 0.9; } .xy-theme__button:hover { background-color: var(--xy-controls-button-background-color-hover-default); } .xy-theme__button:active { background-color: var(--color-hover-bg); } .xy-theme__button:disabled { color: var(--color-disabled); opacity: 0.8; cursor: not-allowed; border: 1px solid var(--color-disabled); } .xy-theme__button > span { margin-right: 0.2rem; } /* Add gap between adjacent buttons */ .xy-theme__button + .xy-theme__button { margin-left: 0.3rem; } /* Example Input Styling */ .xy-theme__input { padding: 0.5rem 0.75rem; border: 1px solid var(--color-primary); border-radius: 7px; background-color: var(--color-background); transition: background-color 0.2s ease, border-color 0.2s ease; font-size: 1rem; color: var(--xy-theme-panel-text); } .xy-theme__input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-focus); } /* Specific Checkbox Styling */ .xy-theme__checkbox { appearance: none; -webkit-appearance: none; width: 1.25rem; height: 1.25rem; border-radius: 7px; border: 2px solid var(--color-primary); background-color: var(--color-background); transition: background-color 0.2s ease, border-color 0.2s ease; cursor: pointer; display: inline-block; vertical-align: middle; margin-right: 0.5rem; } .xy-theme__checkbox:checked { background-color: var(--color-primary); border-color: var(--color-primary); } .xy-theme__checkbox:focus { outline: none; box-shadow: 0 0 0 2px var(--color-primary-focus); } /* Dropdown Styling */ .xy-theme__select { padding: 0.5rem 0.75rem; border: 1px solid var(--color-primary); border-radius: 50px; background-color: var(--color-background); transition: background-color 0.2s ease, border-color 0.2s ease; font-size: 1rem; color: var(--xy-theme-panel-text); margin-right: 0.5rem; box-shadow: var(--xy-node-boxshadow-default); } .xy-theme__select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-focus); } .xy-theme__label { margin-top: 10px; margin-bottom: 3px; display: inline-block; color: var(--xy-theme-panel-text); } /* Range Slider Styling */ .xy-theme__input[type='range'], .xy-theme__range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 0.5rem; padding: 0; border: none; border-radius: 100px; background: transparent; cursor: pointer; } .xy-theme__input[type='range']:focus, .xy-theme__range:focus { outline: none; box-shadow: none; } .xy-theme__input[type='range']::-webkit-slider-runnable-track, .xy-theme__range::-webkit-slider-runnable-track { width: 100%; height: 0.5rem; border-radius: 100px; background: linear-gradient( to right, var(--color-primary-muted) 0%, var(--color-primary-muted) var(--range-progress, 0%), var(--color-hover-bg) var(--range-progress, 0%), var(--color-hover-bg) 100% ); } .xy-theme__input[type='range']::-webkit-slider-thumb, .xy-theme__range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 1.25rem; height: 1.25rem; margin-top: -0.375rem; border-radius: 50%; border: 2px solid var(--color-background); background: var(--color-primary); box-shadow: var(--xy-node-boxshadow-default); } .xy-theme__input[type='range']::-moz-range-track, .xy-theme__range::-moz-range-track { width: 100%; height: 0.5rem; border-radius: 100px; background: var(--color-hover-bg); } .xy-theme__input[type='range']::-moz-range-thumb, .xy-theme__range::-moz-range-thumb { width: 1.25rem; height: 1.25rem; border: none; border-radius: 50%; background: var(--color-primary); box-shadow: var(--xy-node-boxshadow-default); } .xy-theme__input[type='range']::-moz-range-progress, .xy-theme__range::-moz-range-progress { height: 0.5rem; border-radius: 100px 0 0 100px; background: var(--color-primary-muted); }