Tag Input Field - Input Box for Multiple Tags

If you have any suggestions or ideas, I am open to receiving guidance even if it's not a complete solution.

Currently, I am in the process of updating an Email system that was created using React and elements from Blueprint JS.

In the email dialog box, my goal is to transition the To and CC fields from a plain text input to a TagInput system utilizing BlueprintJS/labs' TagInput component.

You can refer to the example provided in the link below:

This TagInput allows for adding new tags dynamically, and as they exceed the width of the input field, it automatically creates a new line to accommodate more tags. However, traditional input fields do not usually support multiline text.

I am facing an issue where, in my implementation, new tags are added on separate lines but without adjusting the height of the input field accordingly. This causes the tags to appear detached from the input field and overlapping other content.

The image below illustrates this problem (the CC field represents the TagInput):

https://i.sstatic.net/9D687.jpg

The TagInput element in my code is defined as follows:

<TagInput
    className='pt-fill pt-input-ghost'
    onChange={(cc: string[]) => this.setState({cc})}
    values={this.state.cc}
    inputValue={this.state.cc_input}
    placeholder='CC:'
    leftIconName='document-share'
/>

Additionally, I have made some CSS modifications to address the issue:

.pt-input{
    overflow-wrap: break-word;
}

.pt-tag-input{
    padding-bottom: 2px;
}

.pt-tag {
    margin-bottom: 2px;
    margin-left: 2px;
}

.pt-tag-input-icon{
    margin-right: 2px;
}

.pt-input-ghost{
    border:none;
    outline-style:none;
    outline:none;
    box-shadow:none;
    border-color:transparent;
    margin: 2px 0px;
    background-color:transparent;
}

.pt-input-ghost:focus{
    border:none;
    outline-style:none;
    outline:none;
    box-shadow:none;
    border-color:transparent;
    background-color:transparent;
    width: auto;
}

Thank you for any assistance provided :)

Once again, I am open to receiving guidance or ideas if a complete solution is not available.

Answer №1

Let's talk about the unique TagInput design: It may look like an <input> element, but in reality, it's a creatively styled div filled with tags and a hidden <input> at the end for your text input.

The component's default design allows it to dynamically adjust its height based on the content inside, which can span multiple lines if needed.

Based on the screenshot you provided, it seems like there are additional styles in your app (not mentioned previously) that are causing issues with the expected growth of the TagInput, resulting in tags overflowing and covering the content below.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilize jQuery to replace the text

I've been attempting to update text on a website using the following script: <script type="text/javascript"> $(document).ready(function () { $(function() { $(document.body).find('*').each(function() { ...

Attempting to utilize express-load in conjunction with express 4

As a beginner in NodeJS, I encountered a problem with my code. Let me show you the issue. I am trying to load the application in the MVC pattern using express-load, but I am facing an error when defining the load order. Here is the important part of app. ...

Building and bundling with BuildBundlerMinifier: a step-by-step guide on updating Site.less/site.css and minimizing the output

Having multiple inquiries regarding my ASP.NET MVC CORE 2.2 project. The primary objective is quite straightforward - updating the stylesheet and deploying the changes. I am in possession of Site.less, site.css, site.min.css, site.min.css.gz files that nee ...

Getting the hang of revealing a div through flashing

Is it possible to make a div flash using CSS alone? My goal is to have this div alternate between two colors. .chat-window .msg-container-base .notification-message-unread{ float: right; font-size: 10px; color: #666; background: white; padding ...

Updating checkboxes in Vue.js

I'm struggling a bit with VueJS states. Here is the setup for my simple app: new Vue({ el: '#media-app', data: { activeTypes: [], activeCategories: [], medias: [] }, methods: { getFilteredDat ...

ASP view displaying overlapping controls

I currently have a form written in ASP that incorporates JQuery for handling two elements: an image upload and a datepicker. The code snippet responsible for the image upload functionality is $(function() { $("#wcpImage").makeAsyncUploader({ uplo ...

Automatically, the "ng-hide" class gets added despite using the correct syntax for ng-show

I am trying to dynamically show/hide a tr tag within a table based on the value of a scope variable in the controller. Despite writing the code correctly, I am facing an issue where the "ng-hide" class is automatically added to the tr tag every time it is ...

Emulate the CSS hover effect with jQuery 코드 희미한

Is there a method in jquery or any other technology that can detect event X and trigger a different event elsewhere? Currently, I am working with an image that has an image map. When a user hovers over a specific area on the map, I would like another part ...

Making a JavaScript script compatible with select drop down menus that can handle multiple selections

After searching through various sources, I came across two threads that address my question regarding the code to use. Despite finding solutions, I am struggling to understand how to implement the script. My limited experience with JavaScript is likely cau ...

Develop a user-friendly online platform for executing a numerical simulation program written in Python, complete with suggestions for optimal hosting solutions

I am embarking on the task of developing a web interface for a Python numerical simulation code and finding a suitable host for both the interface and Python code. The simulations that users run may require hours or even days to complete, necessitating par ...

Modify the design of the button in the CSS code

I am facing an issue with the layout of the Visible Columns button and unable to standardize it like the buttons above using CSS enter image description here The code snippet for the Visible Columns button is as follows: import React, { useState, useEffe ...

Click on the link to open the URL in an interactive inline fancybox

I have implemented a fancybox that loads inline content. The content is displayed on the page as the website loads, and when the document is ready, the fancybox is shown using the following HTML and javascript code; HTML: <div style="display: none"> ...

how to make a scroll event bubble in rxjs

When using vanilla JavaScript, I can easily catch any scroll event on any element by including true as the last argument: document.addEventListener('scroll', function(e) { console.log(e); }, true); However, with rxjs it's not as straight ...

Checking the size of uploaded files for validation

Validation can be a tricky issue, especially when using PHP. While PHP has all the necessary functions to make it work, it uploads the file to a temporary location first and then checks, causing delays. If someone uploads a large 100mb file, they have to w ...

Retrieve the text value from a single object by utilizing jQuery

I am struggling with customizing a product page that lists various products in a list format. My goal is to create an alert that displays only the name of the product when clicked, rather than showing both the name and price as it currently does. Can someo ...

Turn off transparency for the child element if the parent element has transparency

In my design setup, there is a container with an opacity set at 0.8. This allows the background image to subtly shine through the content area. The challenge arises when I place a client photo inside this container. The issue is that the photo's opac ...

Error: The fetch API encountered an unexpected termination before completing the request

A new issue has come up in my project, and although I found a similar problem on this link, it does not address my specific issue. What I have set up is a straightforward API using nodejs, express-framework, and mongoose. The issue lies with the fetch API ...

Is it possible to create a special case for the beforeunload function?

Is there a way to exclude a specific URL or form button from the beforeunload event in JavaScript? I want to exempt them, not as error handling exceptions but to customize how they interact with this event. Here is the relevant JavaScript code: if(loggedi ...

When resizing the browser, HTML/CSS elements tend to shift positions :(

I've experimented with different position values like absolute, fixed, and static without success. Wrapping the element in a div didn't yield the desired result, so I'm seeking assistance to correct this. (If that is the solution) The issu ...

Searching for a way to revalidate post changes using react-query?

I've implemented basic data fetching and updating using react-query in a next.js app. My objective is to update the data after a mutation occurs. Currently, the data only updates when the tab is refreshed. Without user interaction, it remains unchange ...