Make ion-textarea resizable - ionic-framework

The Ionic 5 documentation says:
The textarea component accepts the native textarea attributes in addition to the Ionic properties.
But this does not apply to CSS properties of the native textarea, so how is it possible to make the ion-textarea element resizable?

You can try using the below plugin:
https://www.npmjs.com/package/ngx-autosize
OR
npm i ngx-autosize
import { AutosizeModule } from 'ngx-autosize';
below is the code i used in ionic/angular to make the ion-textarea resize:
<ion-textarea
[minRows]="1"
[maxRows]="5"
autosize
placeholder="Start writing..."
></ion-textarea>
you need to import it in and imports array in app.module and page.module where you need to use it.

Related

Can i use Tailwind CSS and Material UI in the same Next js project?

If I used both of them, could I run into conflicts? Is this a good approach to use?
It is possible and the MUI team has been resolved it.
From the documentation:
If you are used to Tailwind CSS and want to use it together with the MUI components, you can start by cloning the Tailwind CSS example project. If you use a different framework or already have set up your project.
It is necessary to Remove Tailwind's base directive in favor of the CssBaseline component provided by #mui/material and fix the CSS injection order.
You can read how: https://mui.com/guides/interoperability/#tailwind-css
Yes you can run both ui framework. But it is not a good approach. Every ui framework has the complete solution for designing ui part. Like in tailwind css you can have the JIT compiler for compilation your custom css. Or the other hand MUI has also.
I think you can go through just only on ui framework. I have suggestion for ui. For your next js project you can use-
Tailwind Css
Theme-ui
Thank you.
Definitely, You will be in a big problem because once you initialize a styling library it applies its basic styles to the components so that if you are using more than one styling library you may not be able to change the behavior or styles of the components.
It also leads to rubbish suggestions while adding classes names and so on.
Stick to a UI libray and go with it.If you cant get it using the ui libraray do it yourself using CSS that could be more interesting and you can have more control over the components.
Use Mui base instead of Mui core.
https://mui.com/base/guides/working-with-tailwind-css/
I have tried using Mui and Tailwindcss together and it's not worth it. First, you will have to use Mui/base instead of Mui/material in order to reduce conflicts check https://mui.com/base/guides/working-with-tailwind-css. And if you really need to customize Mui components styled of the sx prop. This is just my opinion.

Access `style` of a Component

Using Material-UI v1,
I want to access root inside styles of the Button component, and to use it for a whole other component (an input).
Doing import { styles } from 'material-ui/Button'; doesn't seem to work.
Is it possible? if so, then how?
Was able to achieve this using simply import { styles } from 'material-ui/Button/Button';

How to override Ionic2 sass variable just in one page?

I tried to override sass variable in variables.css like this
but it's not what I want.
It seems to change the styles of all tabs.
You just need to do as shown below on the page component which you need to apply.
my.scss
.ios,
.md,
.wp {
page-my {
.margin-top-15 {
margin-top: 15px;//this is just an example
}
}
}
Currently, it is not possible to override a sass variable in one single page, it simply does not work.
This is the response to a similar issue reported in ionic forums:
https://github.com/ionic-team/ionic/issues/7469
One useful solution is to ionic serve your project, open the inspector on your browser, inspect the desired element and see its ionic generated classes to overwrite them manually in the .scss file.
Currently you cannot change sass variables in one page. That's just not how sass works. Sass is meant to be used as a global setting.
There is a work around to change let's say for example the background of a loading container.
You can do this for most.
If you open developer tools and select inspect element on the loading wrapper it gives the class .loading-wrapper as shown in image link below.
css class for loading shown in inspect element
In your app.css
.loadingCss {
.loading-wrapper {
color: #f4f4f4;
background: #2979ff;
}
}
in your component ts add the class to your loading create instance
//initialize a loading overlay
let working = this.loadingCtrl.create({
content: 'Working...',
spinner: 'dots',
cssClass: 'loadingCss'
});
Now you can create multiple instances of loading and have separate classes for loading and add them to your instance and the css will take effect.
Final result is shown in the below image link.
Loading overlays with custom css on two pages
I hope this helps

ionic tab doesn't show correctlly

I use the codes as following to jump to "account" if the user is logined:
.controller('LoginCtrl', function($scope) {
if (is_login) {
$state.go('account');
}
})
But the content was covered by the header.
But the content was covered by the header
If you are using <ion-header-bar> instead of <ion-nav-bar> you might need to use class="has-header" because this way ionic does not arranges ion content tags content automatically. Also do not forget to initialize the ngApp in your javascript code. Also as I experienced before javascript errors might cause the problem as well, check for errors. Here is an example for above: http://jsbin.com/pagacohovohe/1/edit?html,js,output

How to apply TinyMCE on a textarea in Plone? [duplicate]

I have a custom edit (browser page) for my dexterity content type. In template I have defined a form using Bootstrap and added some Angular JS code for form behavior. It is working. :)
I need to replace a simple textarea with rich text widget. So how can I render in my template the rich text widget (one that is normally used in dexterity)?
If you are using Mockup (not sure if anybody use it on Plone 4) you can find tips there: Obtaining the "default" mockup TinyMCE configuration on Plone 5
Otherwise (the Plone 4.3 version of TinyMCE) it's only a matter of CSS classes and configurations.
<textarea name="..."
class="pat-tinymce mce_editable"
data-mce-config JSONCONFIGURATION_HERE">
</textarea>
I've an add-ons that enable TinyMCE on simple forms; look at the cose to find how to obtain the JSON configuration: See rt.zptformfield.
I've also a blogpost about the approach I used there but it's in italian :-) - http://blog.redturtle.it/usare-widget-plone-in-semplici-template-html
It should suffice to apply the class mceEditor on the textarea.
If that shouldn't work, include the initialization in your template:
tinyMCE.init({
elements : "id-of-textarea",
});