Answers.Body: <p><strong>If you want a rich text field on a front end</strong> - this question has been answered in detail here:
  <a href="https://craftcms.stackexchange.com/questions/4225/how-do-i-enable-redactor-rich-text-editor-in-a-front-end-form/4238#4238">How do I enable redactor rich text editor in a front-end form?</a></p>
  
  <p>In short technically possible but not recommended.</p>
  
  <p><strong>If you want a rich text field for a back end, i.e. plugin, form</strong>:</p>
  
  <p>The craft macros for form fields live in <code>craft/app/templates/forms</code> - however I do not believe there is a macro for a rich text field.  There are <code>text</code> and <code>textarea</code> macros you can use.</p>
  
  <p>However, I think it is possible in a plugin - this apparently creates a rich text field widget in your craft dashboard, so you should be able to pinch the relevant code from: <a href="https://github.com/gilleard/RichTextWidget/blob/master/richtextwidget/widgets/RichTextWidget_DashboardWidget.php" rel="nofollow noreferrer">https://github.com/gilleard/RichTextWidget/blob/master/richtextwidget/widgets/RichTextWidget_DashboardWidget.php</a></p>
  
  <p>(Specifically look at <code>public function getSettingsHtml()</code> I think)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-18T07:07:48.853Z
Answers.Text: Well I don't want to have it as a front end resource I just don't really understand how to use it in my backend since I don't have the variable entry or another variable similar to it. But thank you. If craft is unable to create a rich text editor itself, I'll use this method
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-18T07:13:11.400Z
Answers.Text: Oh sorry, my mistake, I missed the plugin bit.  It should be fine in that context.  I'm away from keyboard now but I'll look through the form lib later
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-19T08:03:13.570Z
Answers.Text: I've revised my answer above ... there's no out of the box macro for you, I think, but it looks like it is possible - see the plugin I have linked above.
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-18T02:52:50.467Z
Answers.LastActivityDate: 2016-11-19T08:02:44.113Z
Answers.LastEditDate: 2016-11-19T08:02:44.113Z
Answers.UserDisplayName: Jeremy Daalder
Body: <p>Maybe I have not understand how entries work but I would like to create a rich text field in my plugin without having an entry.</p>
  
  <p>All I want is creating a rich text field with twig but how can I do this? I already read this <a href="https://craftcms.com/docs/rich-text-fields" rel="nofollow noreferrer">https://craftcms.com/docs/rich-text-fields</a> but it was not really helpful. I would just like to have something like this just for a rich text field instead of a normal textfield</p>
  
  <pre><code>{{ forms.textField({
      label: 'Ingredient Name'|t,
      required: true,
      name: 'ingredient[name]',
      value: ingredient ? ingredient.name : null,
      errors: ingredient ? ingredient.errors('name') : null,
   }) }}
  </code></pre>
  
  <p>Could someone please help me?</p>
  
  <p>if I make <code>{{ entry.richTextFieldHandle }}</code> I get the error <code>Variable "entry" does not exist</code> and I don't know how to define entry since I don't use an entry. Do I have to include my own redactor.js if I just want to have an html editor?</p>
  
Tags: <templating>
Title: Twig - render a rich text field
ThreadText: # Twig - render a rich text field
  
  (Asked by: username_0 on 2016-11-17)
  
  Maybe I have not understand how entries work but I would like to create a rich text field in my plugin without having an entry.
  
  All I want is creating a rich text field with twig but how can I do this? I already read this <https://craftcms.com/docs/rich-text-fields> but it was not really helpful. I would just like to have something like this just for a rich text field instead of a normal textfield
  
  ```
  {{ forms.textField({
      label: 'Ingredient Name'|t,
      required: true,
      name: 'ingredient[name]',
      value: ingredient ? ingredient.name : null,
      errors: ingredient ? ingredient.errors('name') : null,
   }) }}
  
  ```
  
  Could someone please help me?
  
  if I make `{{ entry.richTextFieldHandle }}` I get the error `Variable "entry" does not exist` and I don't know how to define entry since I don't use an entry. Do I have to include my own redactor.js if I just want to have an html editor?
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-11-18. Score: 3
  
  **If you want a rich text field on a front end** - this question has been answered in detail here:
  [How do I enable redactor rich text editor in a front-end form?](https://craftcms.stackexchange.com/questions/4225/how-do-i-enable-redactor-rich-text-editor-in-a-front-end-form/4238#4238)
  
  In short technically possible but not recommended.
  
  **If you want a rich text field for a back end, i.e. plugin, form**:
  
  The craft macros for form fields live in `craft/app/templates/forms` - however I do not believe there is a macro for a rich text field. There are `text` and `textarea` macros you can use.
  
  However, I think it is possible in a plugin - this apparently creates a rich text field widget in your craft dashboard, so you should be able to pinch the relevant code from: <https://github.com/gilleard/RichTextWidget/blob/master/richtextwidget/widgets/RichTextWidget_DashboardWidget.php>
  
  (Specifically look at `public function getSettingsHtml()` I think)
  
  > **Comments:**
  > **username_0**: Well I don't want to have it as a front end resource I just don't really understand how to use it in my backend since I don't have the variable entry or another variable similar to it. But thank you. If craft is unable to create a rich text editor itself, I'll use this method  
  > **username_1**: Oh sorry, my mistake, I missed the plugin bit.  It should be fine in that context.  I'm away from keyboard now but I'll look through the form lib later  
  > **username_1**: I've revised my answer above ... there's no out of the box macro for you, I think, but it looks like it is possible - see the plugin I have linked above.  
  
  ---
  
  