Quasar file picker change text color of selected file name in q-file

1.3k Views Asked by At

Quasar File Picker component to change the text color of selected file name in <q-file>. enter image description here

the text file selected is test.odt, how can I change it's text color for example Red?

<q-file
  standout
  class="registration-field text-red"
  bg-color="blue-2"
  v-model="registrationNumber"
  color="red"
>
  <template v-slot:prepend>
    <q-icon name="o_insert_photo" size="24px" color="blue" />
  </template>
  <template v-slot:append>
    <div class="attachment text-grey-14">File</div>
  </template>
</q-file>

I've tried using style props color="red" and it's not working.

anyone know how?

1

There are 1 best solutions below

2
On BEST ANSWER

You can Use the file slot and add text-red class and it works.

<q-file
  standout
  class="registration-field text-red"
  bg-color="blue-2"
  v-model="registrationNumber"
  color="red"
>
  <template v-slot:prepend>
    <q-icon name="photo" size="24px" color="blue"/>
  </template>
  <template v-slot:append>
    <div class="attachment text-grey-14">File</div>
  </template>
  <template v-slot:file="{ index, file }">
    <div class="ellipsis text-red relative-position">
      {{ file.name }}
    </div>

    <q-tooltip>
      {{ file.name }}
    </q-tooltip>
  </template>
</q-file>

Codepen- https://codepen.io/Pratik__007/pen/wvWzOoV