-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsurvey.qmd
More file actions
94 lines (72 loc) · 2.42 KB
/
survey.qmd
File metadata and controls
94 lines (72 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
# The YAML header specifies several settings for the survey but is not required.
# A full list of settings can be found under _survey/settings.yml directory.
# Use this section to customize theme, progress bar, and footers
theme-settings:
theme: default
barposition: top
footer-left: "Made with [surveydown](https://surveydown.org)"
footer-right: '[<i class="bi bi-github"></i> Source Code](https://github.com/surveydown-dev/template_default)'
# Use this section to customize survey behavior and appearance
survey-settings:
show-previous: false
use-cookies: false
auto-scroll: false
rate-survey: false
system-language: en
highlight-unanswered: true
highlight-color: blue
capture-metadata: true
all-required: false
all-shuffled: false
# Use this section to customize system messages
system-messages:
warning: Warning Message
previous: Previous Page
next: Next Page
exit: Finish Survey
---
```{r}
library(surveydown)
```
--- welcome
# Default Template
Welcome to surveydown! This is a default template of a surveydown survey. It has two pages with one question on each page.
Here is a basic "multiple choice" question:
```{r}
sd_question(
type = 'mc',
id = 'penguins',
label = "What's your favorite penguin?",
option = c(
'Adélie' = 'adelie',
'Chinstrap' = 'chinstrap',
'Gentoo' = 'gentoo'
)
)
```
There are several ways to navigate between pages in a surveydown survey:
1. By default, navigation buttons are auto-created by the end of each survey page.
2. You can also call `sd_nav()` by the end of a page, which is equivalent to the auto-creation.
3. `sd_nav()` supports parameters to customize the navigation labels and destinations. For example, on this page, we can call `sd_nav(page_next = "page2", label_next = "Go to Page 2")` to customize the next button label and destination.
```{r}
sd_nav(page_next = "page2", label_next = "Go to Page 2")
```
--- page2
This is another page in your survey.
{surveydown} supports many types of questions. For example, here is a simple `text` type question:
```{r}
sd_question(
type = "text",
id = "silly_word",
label = "Write a silly word here:"
)
```
On this page, we don't call `sd_nav()` to auto-trigger the navigation button.
--- end
## End
This is the last page in the survey.
Here we call `sd_close()` to create a finish button to end the survey. When calling `sd_close()`, the auto-navigation is disabled.
```{r}
sd_close()
```