VibeFox JS UI — 데모
빠른 시작
일반 HTML
빠른 시작의 주문 폼입니다. 검색 가능한 셀렉트, 과거 날짜를 선택할 수 없는 날짜 선택기, 그리고 토스트를 표시하는 버튼이 있습니다. 셀렉트를 열고 입력해 항목을 필터링한 다음 날짜를 고르고 Order를 클릭하십시오.
document.getElementById('app').innerHTML =
'<form id="order" style="display: grid; gap: 6px; max-width: 320px">' +
'<label for="country">Country</label><div id="country"></div>' +
'<label for="date">Delivery date</label><div id="date"></div>' +
'<div id="send" style="margin-top: 8px"></div>' +
'</form>';
const { createSelect, createDatePicker, createButton, createToast } = VibeFoxJSUi;
createSelect('#country', {
options: [{ value: 'de', label: 'Germany' }, { value: 'fr', label: 'France' }, { value: 'it', label: 'Italy' }, { value: 'es', label: 'Spain' }],
searchable: true,
});
createDatePicker('#date', { min: new Date() });
const toast = createToast(document.body, { position: 'bottom-right' });
createButton('#send', { label: 'Order', on: { click: () => toast.success('Order sent') } });핵심 개념
이벤트
모든 이벤트 핸들러는 하나의 페이로드 객체를 받습니다. 슬라이더를 드래그하거나 방향키를 사용하십시오. 값이 바뀌는 동안 valueChange가 발생하고, 썸을 놓으면 slideEnd가 발생합니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const app = document.getElementById('app');
app.style.maxWidth = '420px';
const slider = VibeFoxJSUi.createSlider('#app', { min: 0, max: 100, value: 20, label: 'Volume', tooltip: true });
const lines = [];
const write = (text) => { lines.unshift(text); output.textContent = lines.slice(0, 5).join('\n'); };
slider.on('valueChange', (e) => write('valueChange ' + e.value));
slider.on('slideEnd', (e) => write('slideEnd ' + e.value));
write('ready — drag the slider');상태 스냅샷
getState()는 사용자가 변경한 내용을 반환하고, setState()는 그 내용을 복원합니다. 탭을 선택하거나 탭을 다른 위치로 드래그한 다음 Save state를 클릭하고, 탭을 다시 변경한 후 Restore state를 클릭하십시오.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const tabs = VibeFoxJSUi.createTabs('#app', {
reorder: true,
tabs: [
{ id: 'a', label: 'Overview', content: 'The first tab.' },
{ id: 'b', label: 'Details', content: 'The second tab.' },
{ id: 'c', label: 'History', content: 'The third tab.' },
],
});
let saved = null;
addButtons([
['Save state', () => { saved = tabs.getState(); output.textContent = 'saved ' + JSON.stringify(saved); }],
['Restore state', () => { if (saved) tabs.setState(saved); output.textContent = 'restored ' + JSON.stringify(tabs.getState()); }],
]);콘텐츠
탭(대화상자, 패널, 타일, 카드 …)의 콘텐츠는 HTML 문자열, DOM 노드 또는 요소를 채우는 함수입니다. 세 탭은 각 형식을 하나씩 보여 줍니다.
const list = document.createElement('ul');
for (const item of ['A DOM node', 'made with createElement']) list.appendChild(document.createElement('li')).textContent = item;
VibeFoxJSUi.createTabs('#app', {
tabs: [
{ id: 'html', label: 'HTML string', content: '<p>An <b>HTML</b> string of your page.</p>' },
{ id: 'node', label: 'DOM node', content: list },
{ id: 'fn', label: 'Renderer', content: (host) => { host.textContent = 'Filled by a function at ' + new Date().toLocaleTimeString(); } },
],
});버튼
Button
변형, 아이콘, 비활성 버튼입니다. Save를 클릭하면 (모의) 작업이 진행되는 동안 스피너가 표시됩니다.
const app = document.getElementById('app');
app.style.cssText = 'display: flex; flex-wrap: wrap; gap: 8px; align-items: center';
const add = (options) => VibeFoxJSUi.createButton(app.appendChild(document.createElement('span')), options);
for (const variant of ['primary', 'secondary', 'danger', 'outline', 'ghost']) add({ label: variant[0].toUpperCase() + variant.slice(1), variant });
add({ label: 'Next', iconRight: 'chevron-right', variant: 'outline' });
add({ label: 'Disabled', disabled: true });
const save = add({ label: 'Save', icon: 'check' });
save.on('click', async () => {
save.setLoading(true);
await new Promise((resolve) => setTimeout(resolve, 1000));
save.setLoading(false);
});ButtonGroup and SplitButton
단일 선택 그룹(정렬), 토글 버튼으로 이루어진 다중 선택 그룹, 메뉴가 있는 분할 버튼입니다. 버튼들과 Send의 화살표를 클릭해 보십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 12px; justify-items: start';
app.innerHTML =
'<div id="align"></div>' +
'<div id="format"></div>' +
'<div id="send"></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const align = VibeFoxJSUi.createButtonGroup('#align', { label: 'Alignment', selection: 'single', required: true, value: 'left',
items: [{ id: 'left', icon: 'align-start', title: 'Left' }, { id: 'center', icon: 'align-center', title: 'Center' }, { id: 'right', icon: 'align-end', title: 'Right' }] });
const format = VibeFoxJSUi.createButtonGroup('#format', { label: 'Format', selection: 'multiple',
items: [{ id: 'bold', icon: 'bold', title: 'Bold' }, { id: 'italic', icon: 'italic', title: 'Italic' }, { id: 'underline', icon: 'underline', title: 'Underline' }] });
const send = VibeFoxJSUi.createSplitButton('#send', { label: 'Send', items: [{ id: 'later', label: 'Send later' }, { id: 'draft', label: 'Save draft' }] });
align.on('valueChange', (e) => { output.textContent = 'alignment: ' + e.value; });
format.on('valueChange', (e) => { output.textContent = 'format: ' + JSON.stringify(e.value); });
send.on('click', () => { output.textContent = 'Send'; });
send.on('itemClick', (e) => { output.textContent = 'menu: ' + e.item.id; });폼 컨트롤
Input and NumberInput
마스크가 적용된 전화번호 필드, 지우기 기능이 있는 이메일 필드, 숫자 입력 두 개입니다. Phone에 숫자를 입력하고 Quantity에서 방향키를 사용하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div><label for="phone">Phone</label><div id="phone"></div></div>' +
'<div><label for="email">E-mail</label><div id="email"></div></div>' +
'<div><label for="qty">Quantity</label><div id="qty"></div></div>' +
'<div><label for="price">Price</label><div id="price"></div></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const phone = VibeFoxJSUi.createInput('#phone', { mask: '+9 (999) 999-99-99', placeholder: '+1 (555) 123-45-67' });
const email = VibeFoxJSUi.createInput('#email', { type: 'email', clearable: true, value: '[email protected]', prefix: '@' });
const qty = VibeFoxJSUi.createNumberInput('#qty', { value: 1, min: 1, max: 99, step: 1 });
const price = VibeFoxJSUi.createNumberInput('#price', { value: 9.5, min: 0, step: 0.5, precision: 2 });
for (const field of [phone, email, qty, price]) field.on('valueChange', () => {
output.textContent = 'phone ' + phone.getValue() + ', e-mail ' + email.getValue() + ', quantity ' + qty.getValue() + ', price ' + price.getValue();
});Select
검색, 그룹, 태그(태그 두 개와 "+N")를 지원하는 다중 셀렉트, 그리고 단순 단일 셀렉트입니다. 목록을 열고 입력해 필터링하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div><label for="tags">Languages</label><div id="tags"></div></div>' +
'<div><label for="size">Size</label><div id="size"></div></div>';
const tags = VibeFoxJSUi.createSelect('#tags', {
multiple: true, searchable: true, clearable: true, maxTagCount: 2,
options: [
{ value: 'js', label: 'JavaScript', group: 'Web' }, { value: 'ts', label: 'TypeScript', group: 'Web' }, { value: 'css', label: 'CSS', group: 'Web' },
{ value: 'go', label: 'Go', group: 'Server' }, { value: 'rust', label: 'Rust', group: 'Server' }, { value: 'cobol', label: 'COBOL', group: 'Server', disabled: true },
],
});
tags.setValue(['js', 'go', 'rust']);
VibeFoxJSUi.createSelect('#size', { placeholder: 'Pick a size',
options: [{ value: 's', label: 'Small' }, { value: 'm', label: 'Medium' }, { value: 'l', label: 'Large' }] });AutoComplete
첫 번째 필드는 비동기 소스(지연이 있는, 서버를 대신하는 예시 구현)에서 제안 항목을 불러오고, 두 번째 필드는 정적 목록을 퍼지(fuzzy) 방식으로 필터링하며 여러 값을 칩으로 유지합니다. City에 "ber" 또는 "pa"를, Fruits에 "apl"을 입력하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div><label for="city">City</label><div id="city"></div></div>' +
'<div><label for="fruit">Fruits</label><div id="fruit"></div></div>';
const CITIES = ['Amsterdam', 'Athens', 'Barcelona', 'Berlin', 'Bern', 'Bratislava', 'Brussels', 'Budapest', 'Lisbon', 'London', 'Madrid', 'Oslo', 'Paris', 'Prague', 'Rome', 'Vienna', 'Warsaw'];
// stand-in for fetch('/api/cities?q=…'): answers after 300 ms
const source = async (query, { signal }) => {
await new Promise((resolve) => setTimeout(resolve, 300));
if (signal.aborted) return [];
return CITIES.filter((name) => name.toLowerCase().includes(query.toLowerCase())).map((name, id) => ({ id, name }));
};
VibeFoxJSUi.createAutoComplete('#city', { source, minLength: 2, delay: 200, textField: 'name', keyField: 'id', placeholder: 'Type 2 letters' });
VibeFoxJSUi.createAutoComplete('#fruit', { data: ['Apple', 'Apricot', 'Banana', 'Cherry', 'Grape', 'Mango', 'Pineapple'], filter: 'fuzzy', multiple: true });Checkbox, Switch, RadioGroup, Segmented
켬/끔 컨트롤과 여러 항목 중 하나를 고르는 컨트롤입니다. 아래 줄에 각 컨트롤의 값이 표시됩니다. 클릭하거나 Space 키와 방향키를 사용하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 12px; justify-items: start';
app.innerHTML =
'<div id="agree"></div>' +
'<div id="mixed"></div>' +
'<div id="notify"></div>' +
'<div id="plan"></div>' +
'<div id="view"></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const agree = VibeFoxJSUi.createCheckbox('#agree', { label: 'I agree' });
const mixed = VibeFoxJSUi.createCheckbox('#mixed', { label: 'Some items selected', indeterminate: true });
const notify = VibeFoxJSUi.createSwitch('#notify', { label: 'Notifications', checked: true });
const plan = VibeFoxJSUi.createRadioGroup('#plan', { label: 'Plan', inline: true, value: 'm',
options: [{ value: 'm', label: 'Monthly' }, { value: 'y', label: 'Yearly' }, { value: 'l', label: 'Lifetime', disabled: true }] });
const view = VibeFoxJSUi.createSegmented('#view', { label: 'View', value: 'list',
items: [{ value: 'list', label: 'List', icon: 'list' }, { value: 'grid', label: 'Grid', icon: 'grid' }, { value: 'board', label: 'Board' }] });
const show = () => { output.textContent = 'agree ' + agree.getChecked() + ', notifications ' + notify.getChecked() + ', plan ' + plan.getValue() + ', view ' + view.getValue(); };
for (const control of [agree, mixed, notify, plan, view]) control.on('valueChange', show);
show();Slider and Rating
썸 두 개와 툴팁이 있는 범위 슬라이더, 단일 슬라이더, 반 별과 레이블이 있는 평점입니다. 썸을 드래그하고 별 위에 마우스를 올려 보십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div><label for="price">Price</label><div id="price"></div></div>' +
'<div><label for="volume">Volume</label><div id="volume"></div></div>' +
'<div><label for="stars">Rating</label><div id="stars"></div></div>' +
'<div><label for="hearts">Likes</label><div id="hearts"></div></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const price = VibeFoxJSUi.createSlider('#price', { min: 0, max: 500, step: 10, value: [50, 300], tooltip: true });
const volume = VibeFoxJSUi.createSlider('#volume', { min: 0, max: 100, value: 60 });
const stars = VibeFoxJSUi.createRating('#stars', { value: 3.5, max: 5, step: 0.5, labels: ['Bad', 'Poor', 'OK', 'Good', 'Great'] });
VibeFoxJSUi.createRating('#hearts', { value: 2, max: 5, icon: 'heart' });
const show = () => { output.textContent = 'price ' + price.getValue().join(' – ') + ', volume ' + volume.getValue() + ', rating ' + stars.getValue(); };
for (const control of [price, volume, stars]) control.on('valueChange', show);
show();OTP input
세 자리씩 두 그룹으로 나뉜 일회용 코드입니다. 6자리 코드를 입력하거나 붙여넣으십시오. 모든 칸이 채워지면 complete가 발생합니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const code = VibeFoxJSUi.createOTPInput('#app', { label: 'Confirmation code', length: 6, type: 'numeric', groups: [3, 3] });
code.on('valueChange', (e) => { output.textContent = 'value ' + e.value; });
code.on('complete', (e) => { output.textContent = 'complete: ' + e.value; });네이티브 폼의 폼 필드
일반 <form> 안의 VibeFox JS 컨트롤입니다. 필수 필드가 비어 있는 상태에서 Submit을 클릭하면 각 필드의 메시지가 표시되고 첫 번째 필드에 포커스가 이동합니다. 유효한 폼은 아래에 FormData를 표시합니다. Reset은 초기 값을 복원합니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
document.getElementById('app').innerHTML =
'<form id="order" style="display: grid; gap: 12px; max-width: 420px">' +
'<div><label for="name">Name</label><div id="name"></div></div>' +
'<div><label for="qty">Quantity</label><div id="qty"></div></div>' +
'<div><label for="country">Country</label><div id="country"></div></div>' +
'<div><label for="day">Delivery date</label><div id="day"></div></div>' +
'<div id="gift"></div>' +
'<div><label for="score">Your rating</label><div id="score"></div></div>' +
'<div id="buttons" style="display: flex; gap: 8px"></div>' +
'</form>';
const form = document.getElementById('order');
VibeFoxJSUi.createInput('#name', { name: 'name', required: true });
VibeFoxJSUi.createNumberInput('#qty', { name: 'qty', value: 2, min: 1 });
VibeFoxJSUi.createSelect('#country', { name: 'country', required: true,
options: [{ value: 'de', label: 'Germany' }, { value: 'fr', label: 'France' }] });
VibeFoxJSUi.createDatePicker('#day', { name: 'day', required: true });
VibeFoxJSUi.createCheckbox('#gift', { label: 'Gift wrap', name: 'gift', checked: true });
VibeFoxJSUi.createRating('#score', { name: 'score', required: true });
const buttons = document.getElementById('buttons');
VibeFoxJSUi.createButton(buttons.appendChild(document.createElement('span')), { label: 'Submit', on: { click: () => form.requestSubmit() } });
VibeFoxJSUi.createButton(buttons.appendChild(document.createElement('span')), { label: 'Reset', variant: 'secondary', on: { click: () => { form.reset(); output.textContent = 'reset'; } } });
form.addEventListener('submit', (e) => {
e.preventDefault(); // the demo shows the data instead of sending it
output.textContent = 'FormData:\n' + [...new FormData(form)].map(([key, value]) => key + ' = ' + value).join('\n');
});
form.addEventListener('invalid', () => { output.textContent = 'not sent: fill in the required fields'; }, true);날짜, 시간, 색상 선택기
날짜 범위, 시간이 포함된 날짜, 30분 단위의 시간, 투명도가 있는 색상입니다. 각 선택기를 여십시오. 달력은 방향키와 PageUp / PageDown으로 조작합니다.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div><label for="stay">Stay</label><div id="stay"></div></div>' +
'<div><label for="meet">Meeting</label><div id="meet"></div></div>' +
'<div><label for="start">Start</label><div id="start"></div></div>' +
'<div><label for="color">Brand color</label><div id="color"></div></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const stay = VibeFoxJSUi.createDatePicker('#stay', { range: true, format: 'DD.MM.YYYY', firstDay: 1 });
stay.setValue(['2026-07-01', '2026-07-14']);
const meet = VibeFoxJSUi.createDateTimePicker('#meet', { step: 15, hour12: false, value: '2026-11-03T10:30' });
const start = VibeFoxJSUi.createTimePicker('#start', { min: '08:00', max: '18:00', step: 30, value: '09:00' });
const color = VibeFoxJSUi.createColorPicker('#color', { value: '#2563eb', format: 'hex', alpha: true });
const show = () => { output.textContent = 'state of stay ' + JSON.stringify(stay.getState()) + '\nstate of meeting ' + JSON.stringify(meet.getState()) + '\nstart ' + start.getValue() + ', color ' + color.getValue(); };
for (const picker of [stay, meet, start, color]) picker.on('valueChange', show);
show();목록과 트리
ListView and ListBox
체크박스가 있는 목록 상자(비활성 항목 하나 포함)와 순서를 바꿀 수 있는 목록입니다. 항목을 드래그하거나, Alt+ArrowUp / ArrowDown 키를 누르거나, 항목의 Move 핸들을 열어 이동 메뉴를 사용하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px';
app.innerHTML =
'<div><label for="people">Assignees</label><div id="people"></div></div>' +
'<div><label for="tasks">Priorities</label><div id="tasks"></div></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const people = VibeFoxJSUi.createListBox('#people', {
selection: 'multiple', checkboxes: true, keyField: 'id', textField: 'name', height: 200,
data: [{ id: 1, name: 'Ann' }, { id: 2, name: 'Bob' }, { id: 3, name: 'Cleo', off: true }, { id: 4, name: 'Dan' }, { id: 5, name: 'Eve' }],
disabledField: 'off',
});
people.setValue([1, 2]);
const tasks = VibeFoxJSUi.createListView('#tasks', { draggable: true, height: 200,
data: ['Write docs', 'Fix login', 'Review PR', 'Release 1.2', 'Plan sprint'] });
people.on('valueChange', (e) => { output.textContent = 'assignees ' + JSON.stringify(e.value); });
tasks.on('itemMove', (e) => { output.textContent = 'moved ' + e.from + ' → ' + e.to + (e.reason ? ' (' + e.reason + ')' : ''); });TransferList
표시할 열을 선택하십시오. 버튼, 더블클릭 또는 드래그로 목록 사이에서 항목을 이동하고, 선택한 항목의 순서를 바꿀 수 있습니다. 최대 네 개까지 선택할 수 있습니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const columns = VibeFoxJSUi.createTransferList('#app', { titles: ['Available', 'Shown'], reorder: true, draggable: true, search: true, max: 4, height: 200,
data: ['Name', 'Email', 'Phone', 'City', 'Company', 'Country', 'Created'], value: ['Name', 'Email'] });
columns.on('valueChange', (e) => { output.textContent = 'shown: ' + e.value.join(', '); });
columns.transfer('City', 'target');Tree
3상태 체크박스, 검색, 지연 로드되는 하위 항목이 있는 트리입니다(폴더 lib는 서버에서 받아오는 것처럼 짧은 지연 후에 파일을 불러옵니다). lib를 펼치고, 항목을 체크하고, 검색 상자에 입력해 보십시오.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const tree = VibeFoxJSUi.createTree('#app', {
label: 'Folders', checkboxes: true, search: true,
data: [
{ id: 'src', label: 'src', expanded: true, children: [
{ id: 'app', label: 'app.js' },
{ id: 'lib', label: 'lib', lazy: true },
{ id: 'css', label: 'styles', children: [{ id: 'main', label: 'main.css' }, { id: 'print', label: 'print.css' }] },
] },
{ id: 'docs', label: 'docs', children: [{ id: 'readme', label: 'README.md' }] },
],
// stand-in for a server request: the children of a lazy node
load: async (node) => {
await new Promise((resolve) => setTimeout(resolve, 400));
return [{ id: node.id + '/util', label: 'util.js' }, { id: node.id + '/dom', label: 'dom.js' }];
},
});
tree.setChecked('app', true);
tree.on('checkChange', () => { output.textContent = 'checked: ' + tree.getChecked().join(', '); });폼과 파일 업로드
Form
규칙이 포함된 필드 설명으로 구성된 폼입니다. 필드를 비운 채 Register를 클릭하면 오류가 표시됩니다. 유효한 폼은 아래에 값과 해당 폼 요소의 FormData를 표시합니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const form = VibeFoxJSUi.createForm('#app', {
fields: [
{ name: 'email', label: 'Email', type: 'input', props: { type: 'email' }, rules: [{ required: true }, { pattern: '^[^@]+@[^@]+$', message: 'Not an email' }] },
{ name: 'age', label: 'Age', type: 'number', rules: [{ required: true }, { min: 18, message: 'Adults only' }] },
{ name: 'plan', label: 'Plan', type: 'segmented', props: { items: ['Free', 'Pro', 'Team'] } },
{ name: 'start', label: 'Start date', type: 'date' },
{ name: 'terms', label: 'I accept the terms', type: 'checkbox', rules: [{ required: true, message: 'Please accept the terms' }] },
],
value: { plan: 'Free' }, layout: 'horizontal', validateOn: 'change', submitLabel: 'Register', resetLabel: 'Reset',
});
form.on('submit', (e) => {
const data = new FormData(document.querySelector('#app form'));
output.textContent = 'value: ' + JSON.stringify(e.value) + '\nFormData: ' + [...data].map(([key, value]) => key + '=' + value).join(', ');
});
form.on('validate', (e) => { if (!e.valid) output.textContent = 'fix the errors above'; });FileUpload
진행률 표시, 취소, 재시도를 지원하는 청크 단위 업로드입니다. 여기서 전송은 서버를 대신하는 예시 구현입니다(페이지 밖으로 아무것도 전송되지 않습니다). 상자로 파일을 끌어다 놓거나 Add sample files를 클릭하십시오(세 번째 파일은 너무 커서 거부됩니다).
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
// stand-in for your server: "uploads" each chunk in about a second and reports the progress
const fakeServer = async (ctx) => {
for (let step = 1; step <= 10; step++) {
await new Promise((resolve) => setTimeout(resolve, 100));
if (ctx.signal.aborted) throw new Error('aborted');
ctx.onProgress(ctx.chunk.size * step / 10);
}
return { id: ctx.uploadId, chunk: ctx.index + 1 + '/' + ctx.count };
};
const files = VibeFoxJSUi.createFileUpload('#app', {
transport: fakeServer, chunkSize: 256 * 1024, retries: 2, concurrency: 2,
multiple: true, maxFileSize: 1e6, maxFiles: 5, accept: '.txt,.csv,image/*', autoUpload: true, label: 'Attachments',
});
const sample = (name, size) => new File(['x'.repeat(size)], name, { type: 'text/plain' });
addButtons([['Add sample files', () => files.addFiles([sample('report.txt', 600000), sample('notes.txt', 40000), sample('video-dump.txt', 1500000)])]]);
files.on('uploadComplete', (e) => { output.textContent += e.file.name + ' uploaded ' + JSON.stringify(e.response) + '\n'; });
files.on('fileReject', (e) => { output.textContent += e.file.name + ' rejected: ' + e.message + '\n'; });내비게이션
Tabs and Accordion
순서를 바꿀 수 있는 닫기 가능한 탭(탭을 드래그하거나 이동 핸들 사용)과 여러 섹션을 동시에 펼칠 수 있는 아코디언입니다. 탭의 ×를 클릭하거나 Delete 키를 눌러 탭을 닫으십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 20px';
app.innerHTML =
'<div id="tabs"></div>' +
'<div id="faq"></div>';
const tabs = VibeFoxJSUi.createTabs('#tabs', { label: 'Document', closable: true, reorder: true,
tabs: [
{ id: 'a', label: 'Overview', content: '<p>Text of the overview.</p>' },
{ id: 'b', label: 'Details', content: (host) => { host.textContent = 'Rendered by a function.'; } },
{ id: 'd', label: 'Locked', content: 'Not available', disabled: true, closable: false },
] });
tabs.addTab({ id: 'c', label: 'History', content: 'Change log' }, { activate: true });
const faq = VibeFoxJSUi.createAccordion('#faq', { multiple: true, headingLevel: 3,
items: [
{ id: 'q1', title: 'How long is the shipping?', content: '3–5 working days.' },
{ id: 'q2', title: 'Can I return an item?', content: 'Yes, within 30 days.' },
{ id: 'q3', title: 'Do you ship abroad?', content: 'To every EU country.' },
] });
faq.expand('q1');Menu and Toolbar
체크 항목, 구분선, 하위 메뉴가 있는 드롭다운 메뉴와, 회색 상자의 컨텍스트 메뉴와 동일한 메뉴(우클릭 또는 Shift+F10), 그리고 토글 버튼이 있는 도구 모음입니다. 아래 줄에 클릭 결과가 표시됩니다.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 12px; justify-items: start';
app.innerHTML =
'<div id="tools"></div>' +
'<div id="open"></div>' +
'<div id="area"></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
document.getElementById('area').style.cssText = 'width: 260px; padding: 24px; background: #f1f5f9; border-radius: 6px; text-align: center';
document.getElementById('area').textContent = 'Right-click here';
document.getElementById('area').tabIndex = 0;
const menu = VibeFoxJSUi.createMenu(document.body, { label: 'Actions', items: [
{ id: 'copy', label: 'Copy', shortcut: 'Ctrl+C', icon: 'copy' },
{ id: 'cut', label: 'Cut', shortcut: 'Ctrl+X', icon: 'scissors' },
{ id: 'wrap', label: 'Word wrap', checked: true },
{ divider: true },
{ id: 'export', label: 'Export', children: [{ id: 'pdf', label: 'PDF' }, { id: 'csv', label: 'CSV' }] },
{ id: 'delete', label: 'Delete', icon: 'trash', disabled: true },
] });
VibeFoxJSUi.createButton('#open', { label: 'Actions', iconRight: 'chevron-down', variant: 'outline' });
menu.attachTrigger('#open button');
menu.attachContext('#area');
menu.on('itemClick', (e) => { output.textContent = 'menu: ' + e.path.join(' › '); });
const bar = VibeFoxJSUi.createToolbar('#tools', { label: 'Formatting', items: [
{ type: 'toggle', id: 'bold', icon: 'bold', label: 'Bold' },
{ type: 'toggle', id: 'italic', icon: 'italic', label: 'Italic' },
{ type: 'separator' },
{ type: 'button', id: 'undo', icon: 'undo', tooltip: 'Undo' },
{ type: 'button', id: 'redo', icon: 'redo', tooltip: 'Redo' },
{ type: 'spacer' },
{ type: 'custom', render: (host) => { host.textContent = 'Saved'; } },
] });
bar.on('toggleChange', (e) => { output.textContent = 'toolbar: ' + e.id + ' ' + (e.pressed ? 'on' : 'off'); });
bar.on('itemClick', (e) => { output.textContent = 'toolbar: ' + e.id; });Breadcrumb and Pagination
항목이 많을 때 중간 항목을 접는 브레드크럼과 페이지 크기 및 총 개수가 있는 페이지네이션입니다. 페이지를 클릭하고 페이지 크기를 변경하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 20px';
app.innerHTML =
'<div id="path"></div>' +
'<div id="pages"></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
VibeFoxJSUi.createBreadcrumb('#path', { maxItems: 4, items: [
{ id: 'home', label: 'Home', href: '#' }, { id: 'docs', label: 'Docs', href: '#' }, { id: 'lib', label: 'Libraries', href: '#' },
{ id: 'ui', label: 'VibeFox JS UI', href: '#' }, { id: 'nav', label: 'Navigation' },
] });
const pages = VibeFoxJSUi.createPagination('#pages', { total: 240, pageSize: 20, page: 3, pageSizes: [10, 20, 50], showTotal: true });
pages.on('pageChange', (e) => { output.textContent = 'page ' + e.page + ', ' + e.pageSize + ' per page'; });Stepper and Wizard
첫 단계에서 다음으로 넘어가기 전에 필드를 검사하는 마법사입니다. 이름을 비운 채 Next를 클릭하면 오류가 표시됩니다. 두 번째 단계는 선택 사항이며, Finish를 클릭하면 결과가 표시됩니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const name = document.createElement('div');
const wizard = VibeFoxJSUi.createWizard('#app', { linear: true, steps: [
{ id: 'account', title: 'Account', description: 'Your name', content: name, validate: () => nameInput.getValue().trim() !== '' || 'Enter your name' },
{ id: 'address', title: 'Address', optional: true, content: '<p>The address can be added later.</p>' },
{ id: 'done', title: 'Confirm', content: (host) => { host.textContent = 'Check and click Finish.'; } },
] });
const nameInput = VibeFoxJSUi.createInput(name, { label: 'Name', placeholder: 'Your name' });
wizard.on('stepChange', (e) => { output.textContent = 'step: ' + wizard.getActive(); });
wizard.on('finish', () => { output.textContent = 'finished for ' + nameInput.getValue(); });CommandPalette
검색 가능한 명령 목록입니다. Open palette를 클릭하거나(예제 안에서 Ctrl+K / Cmd+K를 누르십시오), "dark" 또는 "new"를 입력하고 Enter를 누르십시오. 최근 명령이 먼저 표시됩니다.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const palette = VibeFoxJSUi.createCommandPalette(document.body, { hotkey: 'mod+k', commands: [
{ id: 'new', title: 'New document', category: 'File', shortcut: 'Ctrl+N', icon: 'file', handler: () => { output.textContent = 'new document'; } },
{ id: 'open', title: 'Open…', category: 'File', shortcut: 'Ctrl+O', icon: 'folder', handler: () => { output.textContent = 'open'; } },
{ id: 'dark', title: 'Dark theme', category: 'View', keywords: ['night', 'theme'], handler: () => VibeFoxJSUi.setTheme('dark') },
{ id: 'light', title: 'Light theme', category: 'View', keywords: ['day', 'theme'], handler: () => VibeFoxJSUi.setTheme('light') },
{ id: 'find', title: 'Find in files', category: 'Edit', shortcut: 'Ctrl+Shift+F', icon: 'search', handler: () => { output.textContent = 'find'; } },
] });
palette.on('commandRun', (e) => { output.textContent = 'run: ' + e.command.id; });
addButtons([['Open palette', () => palette.open(), 'primary']]);대화상자와 오버레이
Dialog
버튼이 있는 모달 대화상자와 모달이 아닌 창입니다. 창을 두 개 열고, 헤더를 드래그해 이동하고, 모서리를 드래그해 크기를 조절하고, 최대화하거나 최소화해 보십시오. 창 메뉴 버튼으로는 드래그하지 않고도 창을 이동할 수 있습니다.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
let count = 0;
addButtons([
['Delete file…', () => {
const dlg = VibeFoxJSUi.createDialog(document.body, {
title: 'Delete file?', content: '<p>report.pdf will be deleted. This cannot be undone.</p>', width: 340,
buttons: [{ id: 'cancel', label: 'Cancel', variant: 'secondary' }, { id: 'ok', label: 'Delete', variant: 'danger' }],
});
dlg.on('buttonClick', (e) => { output.textContent = 'clicked ' + e.id; dlg.close(); });
}, 'danger'],
['Open window', () => {
count++;
VibeFoxJSUi.createDialog(document.body, { title: 'Properties ' + count, modal: false, resizable: true, maximizable: true, minimizable: true,
width: 280, height: 160, x: 20 + count * 30, y: 50 + count * 20, content: '<p>Window ' + count + '. Drag me by the header.</p>' });
}],
]);Drawer
가장자리에서 밀려 들어오는 패널입니다. 왼쪽, 오른쪽 또는 아래에서 열어 보십시오. Esc 키를 누르거나 배경을 클릭하면 닫힙니다.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const drawers = {};
for (const side of ['left', 'right', 'bottom']) {
drawers[side] = VibeFoxJSUi.createDrawer(document.body, { side, size: side === 'bottom' ? 160 : 's', title: 'Filters (' + side + ')',
content: '<p>Filter controls go here.</p>', openOnInit: false });
}
addButtons([['Left', () => drawers.left.open()], ['Right', () => drawers.right.open()], ['Bottom', () => drawers.bottom.open()]]);Toast
모서리에 표시되는 알림입니다. 네 가지 유형이 있으며, 사용할 때까지 남아 있는 작업이 포함된 알림 하나와 Promise를 따르는 알림 하나(로딩 중, 이후 완료)가 있습니다. 최대 세 개만 표시되고 나머지는 대기합니다.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const toast = VibeFoxJSUi.createToast(document.body, { position: 'bottom-right', duration: 4000, max: 3 });
toast.on('actionClick', (e) => { output.textContent = 'action ' + e.action; toast.hide(e.id); });
addButtons([
['Info', () => toast.info('A new version is available')],
['Success', () => toast.success('Saved')],
['Warning', () => toast.warning('The disk is almost full')],
['Error', () => toast.error('Could not connect')],
['With action', () => toast.show({ type: 'warning', title: 'Offline', message: 'Changes are kept locally.', duration: 0, actions: [{ id: 'retry', label: 'Retry' }] })],
['Promise', () => toast.promise(new Promise((resolve) => setTimeout(resolve, 1500)), { loading: 'Uploading…', success: 'Uploaded', error: 'Upload failed' })],
]);Tooltip and Popover
툴팁은 마우스를 올리거나 키보드로 포커스를 받으면 표시됩니다. 제목과 리치 콘텐츠가 있는 팝오버는 클릭하면 열립니다. Help에 마우스를 올리거나 Tab 키로 이동한 다음 Order 42를 클릭하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: flex; gap: 12px';
app.innerHTML = '<span id="help"></span><span id="order"></span>';
VibeFoxJSUi.createButton('#help', { label: 'Help', variant: 'outline' });
const tip = VibeFoxJSUi.createTooltip('#help button', { content: 'Opens the manual', placement: 'bottom' });
VibeFoxJSUi.createButton('#order', { label: 'Order 42', variant: 'secondary' });
const pop = VibeFoxJSUi.createPopover('#order button', { title: 'Order 42', placement: 'bottom',
content: '<p>3 items, 120 EUR</p><p>Delivery on Monday</p>' });Tour
온보딩 투어입니다. 각 대상에 스포트라이트가 적용되고 단계 카드가 함께 표시됩니다. Start tour를 클릭하고 Next 또는 방향키로 단계를 진행하십시오.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const app = document.getElementById('app');
app.style.cssText = 'display: flex; gap: 8px';
app.innerHTML = '<span id="new"></span><span id="share"></span><span id="export"></span>';
VibeFoxJSUi.createButton('#new', { label: 'New', icon: 'plus' });
VibeFoxJSUi.createButton('#share', { label: 'Share', variant: 'secondary' });
VibeFoxJSUi.createButton('#export', { label: 'Export', icon: 'download', variant: 'outline' });
const tour = VibeFoxJSUi.createTour(document.body, { steps: [
{ target: '#new', title: 'Create', content: 'Start a new document here.', placement: 'bottom' },
{ target: '#share', title: 'Share', content: 'Invite your team.', placement: 'bottom' },
{ target: '#export', title: 'Export', content: 'Download as PDF or Excel.', placement: 'bottom' },
] });
addButtons([['Start tour', () => tour.start(), 'primary']]);레이아웃
Splitter
드래그할 수 있는 거터가 있는 세 개의 영역입니다. 첫 번째 영역은 거터를 더블클릭하면 접힙니다. 거터를 클릭하면 이동 메뉴가 열리며, 포커스가 있는 거터는 방향키로 이동할 수 있습니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const box = (text) => '<div style="padding: 12px; height: 100%; box-sizing: border-box; background: #f8fafc">' + text + '</div>';
const app = document.getElementById('app');
app.style.height = '240px';
const split = VibeFoxJSUi.createSplitter('#app', { direction: 'horizontal', panes: [
{ content: box('Navigation'), size: 25, min: 100, collapsible: true },
{ content: box('Editor'), size: 50 },
{ content: box('Preview'), size: 25, min: 100 },
] });
split.on('paneResize', (e) => { output.textContent = 'sizes ' + e.sizes.map((s) => Math.round(s) + '%').join(' / '); });DockLayout
IDE처럼 여러 존(zone)에 배치된 패널입니다. 패널 탭을 다른 존으로 드래그하거나, 탭의 이동 핸들을 열거나(또는 Alt+방향키를 누르고), 왼쪽, 위, 가운데, 아래 또는 오른쪽에 도킹하십시오.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const app = document.getElementById('app');
app.style.height = '360px';
const dock = VibeFoxJSUi.createDockLayout('#app', { zoneSizes: { left: 180, bottom: 110, right: 180 }, panels: [
{ id: 'files', title: 'Files', zone: 'left', content: '<ul><li>index.html</li><li>main.js</li><li>style.css</li></ul>' },
{ id: 'code', title: 'main.js', zone: 'center', content: '<pre>console.log("hello");</pre>', closable: true },
{ id: 'readme', title: 'README.md', zone: 'center', content: '<p>Read me</p>', closable: true },
{ id: 'log', title: 'Console', zone: 'bottom', content: 'Output' },
{ id: 'props', title: 'Properties', zone: 'right', content: 'Width 960' },
] });
dock.on('panelMove', (e) => { output.textContent = 'moved ' + e.id + ' to ' + e.zone; });TileLayout
대시보드 격자입니다. 타일을 헤더로 드래그하여 이동하고, 모서리로 드래그하여 크기를 조절하거나, 그립을 클릭해 이동 메뉴(move, wider, narrower …)를 여십시오. Ctrl+Z로 변경을 실행 취소하며, 폭이 좁으면 타일의 열 수가 줄어듭니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const tiles = VibeFoxJSUi.createTileLayout('#app', {
columns: 12, breakpoints: { 0: 4, 600: 8, 900: 12 }, rowHeight: 60,
tiles: [
{ id: 'sales', title: 'Sales', x: 0, y: 0, w: 6, h: 3, content: 'Chart' },
{ id: 'kpi', title: 'KPI', x: 6, y: 0, w: 3, h: 2, minW: 2, content: '<b style="font-size: 28px">42</b>' },
{ id: 'news', title: 'News', x: 9, y: 0, w: 3, h: 4, collapsible: true, content: 'Text' },
{ id: 'tasks', title: 'Tasks', x: 6, y: 2, w: 3, h: 2, closable: true, content: '3 open' },
],
});
tiles.on('layoutChange', (e) => { output.textContent = e.reason + ': ' + e.layout.map((t) => t.id + ' ' + t.x + ',' + t.y + ' ' + t.w + '×' + t.h).join('; '); });데이터 표시
Card
이미지, 제목, 텍스트, 작업 버튼이 있는 카드입니다. elevated 카드, outlined 카드 및 링크인 카드가 있습니다. Book을 클릭하십시오.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const app = document.getElementById('app');
app.style.cssText = 'display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px';
// a picture made in the code (your image URL goes here)
const picture = (from, to) => 'data:image/svg+xml,' + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="320" height="160">' +
'<defs><linearGradient id="g" x2="1" y2="1"><stop offset="0" stop-color="' + from + '"/><stop offset="1" stop-color="' + to + '"/></linearGradient></defs>' +
'<rect width="320" height="160" fill="url(#g)"/><path d="M0 160 L110 60 L170 120 L230 70 L320 160Z" fill="#ffffff55"/></svg>');
const card = (options) => VibeFoxJSUi.createCard(app.appendChild(document.createElement('div')), options);
const lodge = card({ title: 'Mountain lodge', subtitle: 'From 120 EUR', media: picture('#0ea5e9', '#1e3a8a'), mediaAlt: 'Mountains',
content: '<p>Quiet place near the lake.</p>', variant: 'elevated', actions: [{ id: 'book', label: 'Book', variant: 'primary' }, { id: 'save', label: 'Save', variant: 'ghost' }] });
card({ title: 'City flat', subtitle: 'From 90 EUR', media: picture('#f97316', '#be123c'), mediaAlt: 'City', content: '<p>Five minutes to the old town.</p>', variant: 'outlined' });
card({ title: 'All offers', content: '<p>The whole card is a link.</p>', href: '#offers', footer: '24 places' });
lodge.on('action', (e) => { output.textContent = 'action ' + e.id; });Avatar, Chip, Badge
이니셜이 있는 아바타, 상태 표시와 "+2" 그룹, 선택하고 제거할 수 있는 필터 칩, 버튼 위에 개수가 표시되는 배지와 점 형태의 배지입니다.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 16px; justify-items: start';
app.innerHTML =
'<div id="avatars"></div>' +
'<div id="group"></div>' +
'<div id="chips"></div>' +
'<div id="badges"></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
document.getElementById('avatars').style.cssText = 'display: flex; gap: 8px; align-items: center';
for (const [name, size, status] of [['Ann Lee', 'xs'], ['Bob Stone', 's', 'online'], ['Cleo Park', 'm', 'busy'], ['Dan Roe', 'l', 'away'], ['Eve', 'xl']]) {
VibeFoxJSUi.createAvatar(document.getElementById('avatars').appendChild(document.createElement('span')), { name, size, status });
}
VibeFoxJSUi.createAvatarGroup('#group', { max: 3, items: ['Ann Lee', 'Bob Stone', { name: 'Cleo', status: 'online' }, 'Dan', 'Eve'] });
const filters = VibeFoxJSUi.createChipGroup('#chips', { label: 'Filters', selection: 'multiple', removable: true,
items: ['Open', 'Urgent', { id: 'me', label: 'Mine', icon: 'user' }, 'This week'] });
filters.on('itemRemove', (e) => { output.textContent = 'removed ' + (e.item.label || e.item.id); });
filters.on('valueChange', (e) => { output.textContent = 'selected ' + JSON.stringify(e.value); });
const badges = document.getElementById('badges');
badges.style.cssText = 'display: flex; gap: 24px; align-items: center; padding-top: 8px';
badges.innerHTML = '<span id="inbox"></span><span id="chat"></span>';
VibeFoxJSUi.createButton('#inbox', { label: 'Inbox', variant: 'secondary' });
// the badges sit on the corner of the buttons (attached to their mount elements)
const inbox = VibeFoxJSUi.createBadge('#inbox', { count: 7, max: 99, type: 'error', attached: true });
VibeFoxJSUi.createButton('#chat', { label: 'Chat', variant: 'secondary' });
VibeFoxJSUi.createBadge('#chat', { dot: true, type: 'success', attached: true });
inbox.setCount(12);Progress, Spinner, Skeleton
진행률 표시줄, 스피너, 스켈레톤 플레이스홀더입니다. Load를 클릭하면 표시줄이 채워진 다음 스켈레톤이 콘텐츠로 바뀝니다.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div id="progress"></div>' +
'<div id="spinners"></div>' +
'<div id="skeleton"></div>';
document.getElementById('spinners').style.cssText = 'display: flex; gap: 24px; align-items: center';
const bar = VibeFoxJSUi.createProgressBar('#progress', { value: 30, max: 100, label: true, striped: true });
VibeFoxJSUi.createSpinner(document.getElementById('spinners').appendChild(document.createElement('span')), { size: 'l', label: 'Loading' });
VibeFoxJSUi.createSpinner(document.getElementById('spinners').appendChild(document.createElement('span')), { size: 'l', shape: 'dots', label: 'Loading orders…', showLabel: true });
const skeleton = VibeFoxJSUi.createSkeleton('#skeleton', { rows: 3, avatar: true, animated: true, widths: ['60%', '90%', '40%'] });
addButtons([['Load', () => {
let value = 0;
const timer = setInterval(() => {
value += 10;
bar.setValue(value);
if (value < 100) return;
clearInterval(timer);
skeleton.destroy();
document.getElementById('skeleton').innerHTML = '<b>Ann Lee</b><p>The content is loaded.</p>';
}, 150);
}, 'primary']]);Carousel
화살표, 인디케이터, 스와이프, 루프를 지원하는 슬라이드입니다. 너비에 따라 한 번에 한 장, 두 장 또는 세 장이 표시됩니다. 화살표, 점 또는 방향키를 사용하십시오.
const colors = ['#0ea5e9', '#22c55e', '#f59e0b', '#ef4444', '#8b5cf6', '#14b8a6'];
const slides = VibeFoxJSUi.createCarousel('#app', { label: 'Products', loop: true, perView: { 0: 1, 600: 2, 900: 3 }, perMove: 1,
items: colors.map((color, i) => ({ content: '<div style="height: 140px; display: grid; place-items: center; border-radius: 8px; color: #fff; font: 600 22px system-ui; background: ' + color + '">Slide ' + (i + 1) + '</div>' })) });
slides.goTo(1);칸반
In progress 열에 WIP 한도가 2로 설정된 보드입니다. 라벨, 담당자, 마감일, 진행률이 표시됩니다. 카드를 열 사이로 드래그하거나, 카드의 작은 이동 핸들을 열어 "Move" 메뉴를 사용하십시오. 검색과 빠른 추가를 사용할 수 있으며, Ctrl+Z로 이동을 실행 취소합니다.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const board = VibeFoxJSUi.createKanban('#app', {
columns: [{ id: 'todo', title: 'To do' }, { id: 'doing', title: 'In progress', limit: 2 }, { id: 'done', title: 'Done' }],
cards: [
{ id: 1, column: 'todo', title: 'Write docs', labels: [{ text: 'docs', color: 'info' }], assignees: ['Ann Lee'], due: '2026-11-10' },
{ id: 2, column: 'todo', title: 'Design the logo', labels: ['design'], assignees: ['Cleo Park'] },
{ id: 3, column: 'doing', title: 'Fix login', labels: [{ text: 'bug', color: 'danger' }], progress: 40, assignees: ['Bob Stone'] },
{ id: 4, column: 'doing', title: 'Payment page', progress: 70, due: '2026-11-05' },
{ id: 5, column: 'done', title: 'Set up CI', labels: ['devops'] },
],
wipStrict: true, toolbar: true, quickAdd: true,
});
board.on('cardMove', (e) => { output.textContent = 'moved card ' + e.card.id + ' to ' + e.to.column + ' (' + e.reason + ')'; });
board.on('wipExceed', (e) => { output.textContent = 'the column ' + e.column + ' is full'; });채팅과 AI 프롬프트
Chat
Markdown, 아바타, 반응, 제안 및 입력 중 표시기를 지원하는 메시지입니다. 메시지를 보내면 상대방을 대신하는 예시 구현이 "입력 중"을 표시한 뒤 답합니다. 메시지에 마우스를 올리면 답장, 반응, 복사를 할 수 있습니다.
const app = document.getElementById('app');
app.style.height = '420px';
const chat = VibeFoxJSUi.createChat('#app', {
user: { id: 'me', name: 'Me' },
users: [{ id: 'ann', name: 'Ann Lee', status: 'online' }],
messages: [
{ id: 1, author: 'ann', text: 'Hi! Did you see **the report**?', time: Date.now() - 3600000 },
{ id: 2, author: 'me', text: 'Not yet, sending it to the printer.', time: Date.now() - 3500000, reactions: { '👍': ['ann'] } },
{ id: 3, author: 'ann', text: 'The numbers are in `Q3.xlsx`:\n- sales +12%\n- costs -3%', time: Date.now() - 60000 },
],
suggestions: ['Thanks!', 'I will check it'],
});
// stand-in for the other side: types for a second, then answers
chat.on('send', (e) => {
setTimeout(() => chat.setTyping(['ann']), 300);
setTimeout(() => { chat.setTyping([]); chat.addMessage({ author: 'ann', text: 'You wrote: *' + e.message.text + '*' }); }, 1500);
});AI Prompt
답변이 단어 단위로 스트리밍되는 어시스턴트와의 채팅입니다. 여기서 request 함수는 모델을 대신하는 예시 구현입니다(어디로도 아무것도 전송되지 않습니다). 제안을 클릭하거나 질문을 입력하십시오. Stop은 답변을 중단합니다.
const app = document.getElementById('app');
app.style.height = '420px';
// stand-in for your model: an async generator that streams the answer word by word
async function* fakeModel(prompt, ctx) {
const answer = 'You asked: "' + prompt + '". This is a **streamed** answer from a stand-in model. ' +
'Your request function can return a string, an async iterable, a ReadableStream or a Response of your server.';
for (const word of answer.split(' ')) {
if (ctx.signal.aborted) return;
await new Promise((resolve) => setTimeout(resolve, 60));
yield word + ' ';
}
}
const ai = VibeFoxJSUi.createAIPrompt('#app', {
assistant: { name: 'Assistant' },
suggestions: ['Summarize my week', 'Draft an e-mail'],
request: (prompt, ctx) => fakeModel(prompt, ctx),
retry: true,
});파일 관리자
메모리 내 어댑터(실제 백엔드를 연결하는 위치) 위에서 동작하는 탐색기입니다. 트리에서 폴더를 열고, 상세 보기와 타일 보기를 전환하고, 정렬하고, 검색하고, 이름 바꾸기(F2), 복사 및 붙여넣기를 하고, 파일을 폴더로 드래그하고, 우클릭하여 메뉴를 여십시오.
const fm = VibeFoxJSUi.createFileManager('#app', {
adapter: VibeFoxJSUi.createMemoryFileAdapter([
{ name: 'Documents', children: [
{ name: 'report.pdf', size: 120000 }, { name: 'notes.txt', content: 'Hello from the notes' }, { name: 'budget.xlsx', size: 48000 },
{ name: 'Contracts', children: [{ name: 'lease.pdf', size: 230000 }] },
] },
{ name: 'Images', children: [{ name: 'logo.svg', size: 3200 }, { name: 'team.jpg', size: 840000 }] },
{ name: 'readme.md', content: '# Read me' },
]),
view: 'details', tree: true, preview: true, height: 400,
});
fm.navigate('/Documents');쿼리 빌더
AND / OR 그룹으로 구성된 조건입니다. 아래에는 매개변수가 포함된 SQL, 읽기 쉬운 텍스트, 그리고 조건에 맞는 작은 테이블의 행이 표시됩니다. 규칙 또는 그룹을 추가하고, 필드나 연산자를 변경하십시오.
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const rows = [
{ name: 'Ann', score: 70, city: 'Berlin', active: true }, { name: 'Bob', score: 45, city: 'Paris', active: true },
{ name: 'Cleo', score: 88, city: 'Berlin', active: false }, { name: 'Dan', score: 52, city: 'Rome', active: true },
];
const qb = VibeFoxJSUi.createQueryBuilder('#app', {
fields: [
{ field: 'name', label: 'Name', type: 'text' },
{ field: 'score', label: 'Score', type: 'number' },
{ field: 'city', label: 'City', type: 'list', options: ['Berlin', 'Paris', 'Rome'] },
{ field: 'active', label: 'Active', type: 'boolean' },
],
value: { op: 'and', rules: [{ field: 'score', op: '>=', value: 50 }, { field: 'city', op: 'in', values: ['Berlin', 'Rome'] }] },
});
const show = () => {
const { sql, params } = qb.toSQL({ params: true });
output.textContent = 'SQL: ' + sql + '\nparams: ' + JSON.stringify(params) + '\ntext: ' + qb.toText() +
'\nrows: ' + rows.filter(qb.getPredicate()).map((r) => r.name).join(', ');
};
qb.on('valueChange', show);
show();스프레드시트
수식, 숫자 형식과 스타일, 수식 입력줄, 도구 모음이 있는 시트입니다. Units의 숫자를 변경하면 합계가 따라 바뀌는 것을 확인하고, 셀에 =TAX(D4)를 입력하여 직접 정의한 함수를 사용해 보십시오.
const sheet = VibeFoxJSUi.createSpreadsheet('#app', {
data: { sheets: [{ name: 'Sales', rows: [
['Month', 'Units', 'Price', 'Total'],
['Jan', 10, 2.5, '=B2*C2'],
['Feb', 14, 2.5, '=B3*C3'],
['Mar', 9, 2.75, '=B4*C4'],
], styles: { 'A1:D1': { bold: true, fill: '#e0f2fe' }, 'C2:D5': { numFmt: '#,##0.00' } }, colWidths: { A: 100 } }, { name: 'Notes', rows: [['See Sales']] }] },
functions: { TAX: (x) => x * 0.2 },
rows: 12, cols: 6,
});
sheet.setCell('A5', 'Total');
sheet.setCell('D5', '=SUM(D2:D4)');
sheet.setStyle('A5:D5', { bold: true, fill: '#fef3c7' });이미지 편집기
코드로 그린 그림이 들어 있는 편집기입니다. 자르기, 회전, 뒤집기, 필터, 주석을 실행 취소와 함께 사용할 수 있습니다. 도구 모음에서 도구를 선택하고 화살표나 텍스트를 추가한 다음, 필터를 적용해 보십시오.
// a picture made in the code (your image, URL, File or Blob goes here)
const canvas = document.createElement('canvas');
canvas.width = 640; canvas.height = 400;
const g = canvas.getContext('2d');
const sky = g.createLinearGradient(0, 0, 0, 400);
sky.addColorStop(0, '#38bdf8'); sky.addColorStop(1, '#e0f2fe');
g.fillStyle = sky; g.fillRect(0, 0, 640, 400);
g.fillStyle = '#facc15'; g.beginPath(); g.arc(500, 90, 45, 0, Math.PI * 2); g.fill();
g.fillStyle = '#166534'; g.beginPath(); g.moveTo(0, 400); g.lineTo(200, 170); g.lineTo(360, 330); g.lineTo(470, 220); g.lineTo(640, 400); g.fill();
const editor = VibeFoxJSUi.createImageEditor('#app', { src: canvas, history: true, format: 'image/png' });
editor.addShape({ type: 'text', x: 30, y: 30, text: 'Draft', size: 36, color: '#dc2626' });서명 패드와 바코드
SignaturePad
마우스, 펜 또는 손가락으로 서명합니다(선은 속도를 따라 변합니다). 실행 취소, 다시 실행, 지우기는 도구 모음에 있습니다. Export를 클릭하면 PNG와 SVG의 크기가 표시됩니다.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
document.getElementById('app').style.maxWidth = '480px';
const sign = VibeFoxJSUi.createSignaturePad('#app', { label: 'Signature', penWidth: 2.5, velocity: 0.6, guide: true });
sign.setValue({ width: 300, height: 120, strokes: [{ points: [[20, 80, 1], [60, 40, 1], [90, 85, 1], [130, 45, 1], [170, 90, 1], [220, 60, 1]] }] });
addButtons([['Export', () => {
if (sign.isEmpty()) { output.textContent = 'empty'; return; }
output.textContent = 'PNG data URL ' + sign.toDataURL('image/png', { trim: true }).length + ' chars, SVG ' + sign.toSVG().length + ' chars';
}]]);
sign.on('strokeEnd', () => { output.textContent = 'stroke added'; });QR 코드와 바코드
QR 코드, Data Matrix, EAN-13, Code 128을 브라우저에서 생성합니다(Node에서도 가능). 필드에 입력하여 QR 코드를 변경하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 16px';
app.innerHTML =
'<div><label for="text">QR text</label><div id="text"></div></div>' +
'<div id="codes"></div>';
document.getElementById('codes').style.cssText = 'display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-end';
const place = () => document.getElementById('codes').appendChild(document.createElement('div'));
const qr = VibeFoxJSUi.createQRCode(place(), { value: 'https://example.com/ticket/42', ecLevel: 'M', moduleSize: 4, label: 'Ticket link' });
VibeFoxJSUi.createBarcode(place(), { type: 'datamatrix', value: 'ORDER-42', moduleSize: 5, label: 'Order code' });
VibeFoxJSUi.createBarcode(place(), { type: 'ean13', value: '400638133393', text: true, height: 60, label: 'EAN-13' });
VibeFoxJSUi.createBarcode(place(), { type: 'code128', value: 'VFJS-UI-2026', text: true, height: 60, label: 'Code 128' });
const text = VibeFoxJSUi.createInput('#text', { value: 'https://example.com/ticket/42' });
text.on('valueChange', (e) => qr.setValue(e.value || ' '));테마 및 스타일링
테마
모든 테마에서 같은 컨트롤을 볼 수 있습니다. 기본 제공 테마 세 가지와 vibefox-js-themes.css 팩을 사용합니다. 목록에서 테마를 선택하십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 12px';
app.innerHTML =
'<div><label for="theme">Theme</label><div id="theme"></div></div>' +
'<div id="demo"></div>';
const demo = document.getElementById('demo');
demo.style.cssText = 'display: grid; gap: 12px; padding: 16px; border-radius: 8px; background: var(--vfjs-bg); color: var(--vfjs-fg)';
demo.innerHTML = '<div id="t-buttons" style="display: flex; gap: 8px"></div><div id="t-input"></div><div id="t-switch"></div><div id="t-tabs"></div><div id="t-slider"></div>';
VibeFoxJSUi.createButton(document.getElementById('t-buttons').appendChild(document.createElement('span')), { label: 'Primary' });
VibeFoxJSUi.createButton(document.getElementById('t-buttons').appendChild(document.createElement('span')), { label: 'Secondary', variant: 'secondary' });
VibeFoxJSUi.createInput('#t-input', { label: 'Name', value: 'Ann Lee' });
VibeFoxJSUi.createSwitch('#t-switch', { label: 'Notifications', checked: true });
VibeFoxJSUi.createTabs('#t-tabs', { tabs: [{ id: 'a', label: 'Overview', content: 'Text' }, { id: 'b', label: 'Details', content: 'More' }] });
VibeFoxJSUi.createSlider('#t-slider', { label: 'Volume', value: 40 });
const names = ['light', 'dark', 'high-contrast', 'high-contrast-light', 'paper', 'paper-dark', 'glass', 'glass-dark', 'classic', 'classic-dark',
'ocean', 'ocean-dark', 'forest', 'forest-dark', 'sunset', 'sunset-dark', 'graphite', 'graphite-dark'];
const theme = VibeFoxJSUi.createSelect('#theme', { value: 'light', options: names.map((name) => ({ value: name, label: name })) });
theme.on('valueChange', (e) => VibeFoxJSUi.setTheme(e.value, demo));CSS 변수
모든 색상과 크기는 CSS 변수입니다. 강조 색상과 모서리 반경을 선택하십시오. CSS 규칙이 아래 상자에 --vfjs-accent와 --vfjs-radius를 설정하며, 그 안의 모든 컨트롤이 이를 따릅니다.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div><label for="accent">Accent color</label><div id="accent"></div></div>' +
'<div><label for="radius">Corner radius</label><div id="radius"></div></div>' +
'<div id="demo"></div>';
const demo = document.getElementById('demo');
demo.style.cssText = 'display: grid; gap: 12px; padding-top: 8px';
demo.innerHTML = '<div id="v-button"></div><div id="v-select"></div><div id="v-check"></div><div id="v-slider"></div>';
VibeFoxJSUi.createButton('#v-button', { label: 'Save', icon: 'check' });
VibeFoxJSUi.createSelect('#v-select', { label: 'Plan', value: 'pro', options: [{ value: 'free', label: 'Free' }, { value: 'pro', label: 'Pro' }] });
VibeFoxJSUi.createCheckbox('#v-check', { label: 'Remember me', checked: true });
VibeFoxJSUi.createSlider('#v-slider', { label: 'Level', value: 60 });
const accent = VibeFoxJSUi.createColorPicker('#accent', { value: '#0f766e', swatches: ['#2563eb', '#0f766e', '#c026d3', '#ea580c', '#1f2937'] });
const radius = VibeFoxJSUi.createSlider('#radius', { min: 0, max: 16, value: 4, tooltip: true });
// the variables go on the box: every component inside follows
const rule = document.head.appendChild(document.createElement('style'));
const apply = () => { rule.textContent = '#demo { --vfjs-accent: ' + accent.getValue() + '; --vfjs-radius: ' + radius.getValue() + 'px; }'; };
accent.on('valueChange', apply);
radius.on('valueChange', apply);
apply();모양과 크기
filled, outline, ghost 모양과 s, m, l 크기는 컨테이너에 data-vfjs-ui-variant / data-vfjs-ui-size를 한 번 지정하여 설정합니다.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px';
for (const variant of ['filled', 'outline', 'ghost']) {
for (const size of ['s', 'm', 'l']) {
const box = app.appendChild(document.createElement('div'));
box.setAttribute('data-vfjs-ui-variant', variant);
box.setAttribute('data-vfjs-ui-size', size);
box.style.cssText = 'display: grid; gap: 6px; align-content: start';
box.appendChild(document.createElement('b')).textContent = variant + ' / ' + size;
VibeFoxJSUi.createInput(box.appendChild(document.createElement('div')), { label: 'Name', placeholder: 'Name' });
VibeFoxJSUi.createSelect(box.appendChild(document.createElement('div')), { label: 'Plan', value: 'pro', options: [{ value: 'pro', label: 'Pro' }, { value: 'free', label: 'Free' }] });
VibeFoxJSUi.createButton(box.appendChild(document.createElement('div')), { label: 'Button' });
}
}밀도와 크기
컨테이너의 밀도를 전환하십시오. 내부 모든 컨트롤의 높이와 안쪽 여백이 따라 바뀝니다. 크기 단위 --vfjs-size-unit은 모든 요소의 크기를 한 번에 조정합니다.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; max-width: 420px';
app.innerHTML =
'<div><label for="density">Density</label><div id="density"></div></div>' +
'<div><label for="unit">Size unit</label><div id="unit"></div></div>' +
'<div id="demo"></div>';
const demo = document.getElementById('demo');
demo.style.cssText = 'display: grid; gap: 10px';
demo.innerHTML = '<div id="d-input"></div><div id="d-list"></div><div id="d-button"></div>';
VibeFoxJSUi.createInput('#d-input', { label: 'Search', prefix: 'search', placeholder: 'Search' });
VibeFoxJSUi.createListBox('#d-list', { label: 'Items', data: ['First', 'Second', 'Third'], value: 'Second' });
VibeFoxJSUi.createButton('#d-button', { label: 'Apply' });
const density = VibeFoxJSUi.createSegmented('#density', { value: 'normal', items: ['compact', 'normal', 'comfortable'] });
density.on('valueChange', (e) => demo.setAttribute('data-vfjs-density', e.value));
const unit = VibeFoxJSUi.createSlider('#unit', { min: 0.8, max: 1.3, step: 0.05, value: 1, tooltip: true });
unit.on('valueChange', (e) => demo.style.setProperty('--vfjs-size-unit', e.value + 'px'));직접 작성한 CSS
라이브러리 규칙은 vfjs 캐스케이드 레이어에 있으므로, 페이지의 일반 CSS가 !important 없이도 우선 적용됩니다. 여기서는 primary 버튼이 대문자로, 눌린 토글 버튼이 굵은 글씨로 표시됩니다.
const style = document.createElement('style');
style.textContent = '.vfjs-ui-btn--primary { text-transform: uppercase; letter-spacing: .04em; }' +
' .vfjs-ui-btn--pressed { font-weight: 700; }';
document.head.appendChild(style);
const app = document.getElementById('app');
app.style.cssText = 'display: flex; flex-wrap: wrap; gap: 12px; align-items: center';
VibeFoxJSUi.createButton(app.appendChild(document.createElement('span')), { label: 'Save' });
VibeFoxJSUi.createButton(app.appendChild(document.createElement('span')), { label: 'Cancel', variant: 'secondary' });
VibeFoxJSUi.createButtonGroup(app.appendChild(document.createElement('span')), { label: 'Period', selection: 'single', value: 'week',
items: [{ id: 'day', label: 'Day' }, { id: 'week', label: 'Week' }, { id: 'month', label: 'Month' }] });현지화와 RTL
언어
영어는 기본 내장되어 있으며, 러시아어는 라이브러리 다음에 로드되는 언어 팩 vibefox-js-ui.ru.js에서 제공됩니다. 페이지 언어를 전환하면 달력, 셀렉트, 페이지네이션, 업로드 상자가 해당 언어로 다시 렌더링됩니다.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; justify-items: start';
app.innerHTML =
'<div id="lang"></div>' +
'<div id="select"></div>' +
'<div id="pages"></div>' +
'<div id="calendar"></div>';
const lang = VibeFoxJSUi.createSegmented('#lang', { label: 'Language', value: 'en', items: [{ value: 'en', label: 'English' }, { value: 'ru', label: 'Русский' }] });
lang.on('valueChange', (e) => VibeFoxJSUi.setLocale(e.value));
VibeFoxJSUi.createSelect('#select', { options: [{ value: 1, label: 'One' }, { value: 2, label: 'Two' }] });
VibeFoxJSUi.createPagination('#pages', { total: 120, pageSize: 20, showTotal: true });
VibeFoxJSUi.createDatePicker('#calendar', { inline: true, value: '2026-11-03' });언어 추가
addLocale()은 일부 키에 대해 독일어 문자열을 추가합니다. 값이 주어지지 않은 키는 영어로 대체됩니다. 셀렉트와 페이지네이션은 로케일 de를 사용합니다.
VibeFoxJSUi.addLocale('de', {
'ui.select.placeholder': 'Auswählen…',
'ui.select.searchPlaceholder': 'Suchen…',
'ui.select.empty': 'Nichts gefunden',
'ui.pagination.total': '{total} Einträge',
'ui.pagination.perPage': '/ Seite',
'ui.pagination.prev': 'Vorherige Seite',
'ui.pagination.next': 'Nächste Seite',
});
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px; justify-items: start';
app.innerHTML =
'<div id="select"></div>' +
'<div id="pages"></div>';
VibeFoxJSUi.createSelect('#select', { locale: 'de', searchable: true, options: [{ value: 1, label: 'Eins' }, { value: 2, label: 'Zwei' }] });
VibeFoxJSUi.createPagination('#pages', { locale: 'de', total: 120, pageSize: 20, pageSizes: [10, 20, 50], showTotal: true });RTL
rtl: true를 설정하면 컴포넌트가 오른쪽에서 왼쪽으로 배치되고, 방향키가 읽기 순서를 따릅니다. 방향을 전환해 보십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; gap: 14px';
app.innerHTML =
'<div id="dir"></div>' +
'<div id="path"></div>' +
'<div id="tabs"></div>' +
'<div id="slider"></div>' +
'<div id="input"></div>';
const parts = [
VibeFoxJSUi.createBreadcrumb('#path', { items: [{ label: 'Home', href: '#' }, { label: 'Docs', href: '#' }, { label: 'UI' }] }),
VibeFoxJSUi.createTabs('#tabs', { tabs: [{ id: 'a', label: 'First', content: 'The first tab' }, { id: 'b', label: 'Second', content: 'The second tab' }, { id: 'c', label: 'Third', content: 'The third tab' }] }),
VibeFoxJSUi.createSlider('#slider', { label: 'Volume', value: 30 }),
VibeFoxJSUi.createInput('#input', { label: 'Search', prefix: 'search', clearable: true, value: 'text' }),
];
const dir = VibeFoxJSUi.createSegmented('#dir', { label: 'Direction', value: 'rtl', items: [{ value: 'ltr', label: 'Left to right' }, { value: 'rtl', label: 'Right to left' }] });
const apply = (value) => { for (const part of parts) part.setOptions({ rtl: value === 'rtl' }); };
dir.on('valueChange', (e) => apply(e.value));
apply('rtl');접근성
드래그 없이 이동
드래그할 수 있는 모든 항목에는 "Move…" 메뉴도 있습니다. 항목에 포커스를 두고 Shift+F10을 누르거나, 우클릭하거나, 작은 이동 핸들을 클릭해 작업을 위, 아래 또는 다른 목록으로 옮기십시오.
const app = document.getElementById('app');
app.style.cssText = 'display: grid; grid-template-columns: 1fr 1fr; gap: 16px';
app.innerHTML =
'<div><label for="todo">To do</label><div id="todo"></div></div>' +
'<div><label for="done">Done</label><div id="done"></div></div>';
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const todo = VibeFoxJSUi.createListView('#todo', { draggable: true, dragGroup: 'tasks', height: 190,
data: ['Write docs', 'Fix login', 'Review PR', 'Plan sprint'] });
const done = VibeFoxJSUi.createListView('#done', { draggable: true, dragGroup: 'tasks', height: 190,
data: ['Set up CI', 'Design the logo'] });
for (const list of [todo, done]) list.on('itemMove', (e) => { output.textContent = 'moved ' + JSON.stringify(e.items || e.item || e.from) + ' (' + (e.reason || 'drag') + ')'; });다른 VibeFox JS 라이브러리와 함께 사용하기
link()로 컴포넌트 연결하기
VibeFox JS UI의 쿼리 빌더가 VibeFox JS Grid의 테이블을 필터링합니다(두 라이브러리가 모두 페이지에 있음). link()는 조건의 모든 변경 사항을 grid.setFilterModel()에 전달합니다. 조건을 변경하고 행이 어떻게 바뀌는지 확인하십시오.
const app = document.getElementById('app');
app.innerHTML = '<div id="qb"></div><div id="grid" style="margin-top: 12px"></div>';
const qb = VibeFoxJSUi.createQueryBuilder('#qb', {
fields: [
{ field: 'name', label: 'Name', type: 'text' },
{ field: 'city', label: 'City', type: 'list', options: ['Berlin', 'Paris', 'Rome'] },
{ field: 'score', label: 'Score', type: 'number' },
],
value: { op: 'and', rules: [{ field: 'score', op: '>=', value: 50 }] },
});
const grid = VibeFoxJSGrid.createGrid('#grid', {
height: 220,
columns: [{ field: 'name', header: 'Name' }, { field: 'city', header: 'City' }, { field: 'score', header: 'Score', type: 'number' }],
data: [
{ name: 'Ann', city: 'Berlin', score: 70 }, { name: 'Bob', city: 'Paris', score: 45 }, { name: 'Cleo', city: 'Berlin', score: 88 },
{ name: 'Dan', city: 'Rome', score: 52 }, { name: 'Eve', city: 'Paris', score: 91 }, { name: 'Finn', city: 'Rome', score: 30 },
],
});
grid.setFilterModel(qb.getFilterModel());
const unlink = VibeFoxJSUi.link(qb, 'filterChange', grid, 'setFilterModel', (e) => e.filterModel);AI 도구
코드에 있는 모델 함수를 대신하는 예시 구현으로 동작하는 도구 루프입니다(실제 모델을 여기에 연결합니다). 이 루프는 도구 sheet_set_range를 요청하여 시트에 합계 행을 기록하고, 이어서 sheet_format_range로 해당 행을 굵게 표시합니다. Ask를 클릭하십시오.
function addButtons(buttons) {
const bar = document.createElement('div');
bar.id = 'bar';
bar.style.cssText = 'display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px';
for (const [label, click, variant] of buttons) {
VibeFoxJSUi.createButton(bar.appendChild(document.createElement('span')), { label, variant: variant || 'secondary', on: { click } });
}
document.getElementById('app').before(bar);
}
const output = document.createElement('pre');
output.style.cssText = 'margin: 12px 0 0; min-height: 3em; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap';
document.getElementById('app').after(output);
const app = document.getElementById('app');
app.style.height = '260px';
const sheet = VibeFoxJSUi.createSpreadsheet('#app', { toolbar: false, data: { sheets: [{ name: 'Sales', rows: [['Month', 'Units'], ['Jan', 10], ['Feb', 14], ['Mar', 9]] }] } });
const kit = VibeFoxJSUi.createToolKit({ budget: sheet });
// stand-in for your model: first it calls the tools, then it answers with text
const model = async (request) => {
if (request.messages.at(-1).role === 'tool') return { text: 'Added a total row under the units.' };
return { toolCalls: [
{ id: 'c1', name: 'budget_sheet_set_range', arguments: { range: 'A5:B5', values: [['Total', '=SUM(B2:B4)']] } },
{ id: 'c2', name: 'budget_sheet_format_range', arguments: { range: 'A5:B5', style: { bold: true, fill: '#fef3c7' } } },
] };
};
addButtons([['Ask', async () => {
const answer = await kit.ask('Add a total row under the units', { model });
output.textContent = 'tools: ' + kit.tools().map((t) => t.name).join(', ') + '\ncalls: ' + answer.calls.map((c) => c.name + (c.result.ok ? ' ok' : ' error ' + c.result.error)).join(', ') + '\nmodel: ' + answer.text;
}, 'primary']]);