nebular icon indicating copy to clipboard operation
nebular copied to clipboard

How to show icon in nbInput

Open petertw6235 opened this issue 5 years ago • 4 comments

Issue type

I'm submitting a ... (check one with "x")

  • [ ] bug report
  • [x] feature request

Issue description

I saw the example code in nebular website: <input [nbDatepicker]="datepicker" nbInput> <nb-datepicker #datepicker></nb-datepicker> That works fine, but I want to put icon into nbInput like this: image

I couldn't find any example about nbIcon in input. Have any ideas about this?

petertw6235 avatar Jan 14 '20 07:01 petertw6235

Perhaps it will help you) image image image

EvgenyProkopovich avatar Jan 15 '20 14:01 EvgenyProkopovich

I just added a span

<div class="amount"
    <input fieldSize="small" type="number" class="amount-input" name="total_amount" #total_amount="ngModel" [(ngModel)]="check.total_amount" nbInput fullWidth placeholder="Importe diario">
    <span class="suffix">€</span>
</div>

  .amount {
    display: table;
    border-collapse: separate;
    position: relative;
  }
  .amount-input {
    border-radius: 0.25rem 0rem 0rem 0.25rem;
    position: relative;
    float: left;
    width: 100%;
    margin-bottom: 0;
    display: table-cell;
    margin: 0;
  }

  .suffix {
    border-radius: 0rem 0.25rem 0.25rem 0rem;
    padding: 0 12px;
    color: #555;
    text-align: center;
    background-color: #eee;
    border: 1px solid #ccc;
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
    display: table-cell;
  }

image

luischueneuien avatar Jan 16 '20 08:01 luischueneuien

Hello , This works as well :

<nb-form-field>
                      <input
                        #dateInput
                        id="date"
                        nbInput
                        placeholder="select a date"
                        [nbDatepicker]="datePicker"
                      />
                      <button nbSuffix nbButton ghost (click)="dateInput.click()">
                        <nb-icon icon="calendar"> </nb-icon>
                      </button>
                      <nb-datepicker #datePicker format="dd\MM\yyyy"></nb-datepicker>
</nb-form-field>

image

chakib-mohamed avatar Nov 02 '20 10:11 chakib-mohamed

Hello , This works as well :

<nb-form-field>
                      <input
                        #dateInput
                        id="date"
                        nbInput
                        placeholder="select a date"
                        [nbDatepicker]="datePicker"
                      />
                      <button nbSuffix nbButton ghost (click)="dateInput.click()">
                        <nb-icon icon="calendar"> </nb-icon>
                      </button>
                      <nb-datepicker #datePicker format="dd\MM\yyyy"></nb-datepicker>
</nb-form-field>

image

This is worked, but was necessary put everything inside a <div> with CSS display: flex

victorwvieira avatar Jun 10 '22 12:06 victorwvieira