7

I would like to display text area resource field content always without showing option "Show Content" or display it by default.

enter image description here

Is it possible?

Saumini Navaratnam
  • 8,439
  • 3
  • 42
  • 70

1 Answers1

16

As of v1.1.4

There is now an option to always show.

Textarea::make('Title')->alwaysShow()

As of v1.0.19

You cannot. If you take a look at the TextareaField.vue (nova/resources/js/components/Detail/TextareaField.vue):

<template>
    <panel-item :field="field">
        <template slot="value">
            <excerpt :content="field.value" />
        </template>
    </panel-item>
</template>

Then if you take a look at Excerpt.vue (nova/resources/js/components/Excerpt.vue):

<div v-if="hasContent">
    <div v-if="expanded" class="markdown leading-normal" v-html="content" />

    <a
        @click="toggle"
        class="cursor-pointer dim inline-block text-primary font-bold"
        :class="{ 'mt-6': expanded }"
        aria-role="button"
    >
        {{ showHideLabel }}
    </a>
</div>

And the props of the vue:

props: {
    content: {
        type: String,
    },
},

data: () => ({ expanded: false }),

There's no option to pass the expanded attribute.

Chin Leung
  • 14,621
  • 3
  • 34
  • 58