Widget problems
A widget problem is solved inside a small web page you write, instead of by writing a program. The participant reads the statement, then clicks, drags or draws in the page below it, and submits what they built there. This is the shape of a Bebras task: the question is a picture you interact with, and the answer is a state — which cells are marked, which path was drawn, how the boxes were ordered.
You upload the page as a zip archive. Eolymp shows it under the statement and asks it for the answer when the participant submits. The answer is a JSON document of your own design, which only your page and your checker ever read.
The widget is only the answer input. The question, the rules and the submit button belong to the statement and the problem page, and the widget never shows whether an answer is right.
A widget problem works wherever a problem does: in your space's problem archive, in contests and in courses.
Create a widget problem
Open Problems, click New problem and choose Widget.
Write the statement.
On the problem's Widget tab, Upload the archive.
On the same tab, set the Checker. It must be a program.
Try the widget in the preview on the Widget tab and Submit an answer to see it graded.
Publish the problem.
You need permission to write problems. A widget problem has no Solutions or Testing tab and does not open in the Studio. Re-upload replaces the page; submissions already made keep the page they were made in, so they can be shown back as they were.
Build a widget
Widgets are built with the Eolymp widget SDK, published on npm as @eolymp/widget. It needs Node.js and nothing else:
npx @eolymp/widget init my-widget # a starter: index.html, widget.js, style.css and the SDK in lib/
npx @eolymp/widget dev my-widget # runs the widget locally the way Eolymp hosts it
npx @eolymp/widget pack my-widget # checks the folder against the rules below and writes my-widget.zipdev opens a page that hosts the widget under the same sandbox as Eolymp. It shows the answer the widget produces, switches between solving and viewing a submission, and between phone and desktop widths. A widget that works there works on Eolymp.
A widget is plain HTML and JavaScript. The starter answers with a 4×4 grid of cells:
<link rel="stylesheet" href="./lib/widget-sdk.css">
<div id="board"></div>
<script src="./lib/widget-sdk.js"></script>
<script>
const board = eolymp.grid("#board", { rows: 4, cols: 4 });
eolymp.widget({ answer: board });
</script>The participant clicks cells to mark them, and the widget submits [[0,1,0,0],[0,0,1,0],…]. The SDK keeps drafts, shows past submissions back, and locks the widget while a submission is viewed.
The SDK covers the common kinds of input:
Helper | The participant | Answer |
|---|---|---|
| clicks cells to cycle their value |
|
| chooses one picture, node or option |
|
| selects several, in the order clicked |
|
| builds a route step by step |
|
| drags items into boxes |
|
| puts items in order |
|
The pick helpers work on SVG shapes as well as HTML elements. Anything else is built with eolymp.state, which holds a custom answer. The full reference is AGENTS.md, which init also copies into every new widget so that an AI assistant working in the folder reads it before writing code.
How a widget answer is graded
A widget problem has no tests. Each submission is judged once, worth 100 points, by the checker alone: the answer the widget produced is handed to it as the participant's output file, and the input and answer files are empty. The checker holds whatever the task expects.
Any checker mode works. In the Eolymp and Testlib modes the checker exits with 0 for a full score and 1 for a wrong answer; for part of the score it prints points <n> and exits with 7, which gives the Partially correct verdict. TEST_COST in the environment holds what the run is worth.
Compare answers as JSON rather than as text: key order and spacing carry no meaning, so a text comparison of two JSON documents rejects correct answers. Where several answers are correct, such as two routes of the same length, the checker verifies the answer rather than comparing it with one expected value.
The archive
The archive holds a page and everything it needs. index.html is loaded first.
my-widget.zip
├── index.html
├── widget.js
├── style.css
├── lib/
│ ├── widget-sdk.js
│ └── widget-sdk.css
└── images/
└── board.pngZipping the folder itself works too; a single top-level folder is unwrapped for you. Everything the page loads must be inside the archive and referenced by a relative path. A widget cannot load a script, a stylesheet, a font or an image from anywhere else, and it cannot call an API. That is why the SDK is copied into lib/ instead of being loaded from a CDN, and what makes it safe to run someone else's page next to a contest.
Unpacked size | 50 MB, at most 1000 files, 10 MB each |
Markup and code |
|
Images |
|
Fonts |
|
Audio and video |
|
Any other file is refused, and so are symbolic links and paths pointing outside the archive. pack checks all of this before writing the zip.
The page runs sandboxed, in its own origin. It cannot read cookies, reach the surrounding page or open windows, and localStorage and sessionStorage throw rather than returning empty. Keep state in variables, and let Eolymp keep the answer.
Without the SDK
The SDK speaks a small message protocol to the problem page. A widget written without it, or a page ported from elsewhere, implements the same protocol; it is specified in the SDK's README. The answer is a JSON string of at most 64 KB.