Skip to content

Commit

Permalink
docs: Add styling
Browse files Browse the repository at this point in the history
  • Loading branch information
davidberenstein1957 committed Oct 7, 2024
1 parent e32a32f commit 446a18d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions argilla/docs/how_to_guides/custom_fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,17 @@ Let's reproduce example from the [Without advanced mode](#without-advanced-mode)

```python
template = """
<div id="custom-field-container"></div>
<div id="content"></div>
<script id="template" type="text/x-handlebars-template">
<style>
#container {
display: flex;
gap: 10px;
}
.column {
flex: 1;
}
</style>
<div id="container">
<div class="column">
<h3>Original</h3>
Expand All @@ -200,13 +209,13 @@ script = """
const template = document.getElementById("template").innerHTML;
const compiledTemplate = Handlebars.compile(template);
const html = compiledTemplate({ record });
document.getElementById("custom-field-container").innerHTML = html;
document.getElementById("content").innerHTML = html;
</script>
""" # (2)
```

1. This is a JavaScript template script. We set `id` to `template` to use it later in our JavaScript code and `type` to `text/x-handlebars-template` to indicate that this is a Handlebars template. Note that we also added a `div` with `id` to `custom-field-container` to render the template into.
2. This is a JavaScript template script. We load the Handlebars library and then use it to compile the template and render the record. Eventually, we render the result into the `div` with `id` to `custom-field-container`.
1. This is a JavaScript template script. We set `id` to `template` to use it later in our JavaScript code and `type` to `text/x-handlebars-template` to indicate that this is a Handlebars template. Note that we also added a `div` with `id` to `content` to render the template into.
2. This is a JavaScript template script. We load the Handlebars library and then use it to compile the template and render the record. Eventually, we render the result into the `div` with `id` to `content`.

We can now pass these templates to the `CustomField` class, ensuring that the `advanced_mode` is set to `True`.

Expand Down

0 comments on commit 446a18d

Please sign in to comment.